Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
gnome-class
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ian P. Cooke
gnome-class
Commits
95a79b62
Commit
95a79b62
authored
Nov 15, 2018
by
Federico Mena Quintero
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Docs: mention the required dependencies on the user's Cargo.toml
parent
ac831a19
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
37 deletions
+34
-37
src/lib.rs
src/lib.rs
+34
-37
No files found.
src/lib.rs
View file @
95a79b62
...
...
@@ -5,9 +5,10 @@
//! Generates code to create a derived `glib::Object`
//!
//! This procedural macro defines an extension to the Rust language so
//! that one can create GObject implementations using only safe code.
//! All the boilerplate needed to register the GObject type, its
//! signals and properties, etc., is automatically generated.
//! that one can create GObject implementations, or define
//! GTypeInterfaces, using only safe code. All the boilerplate needed
//! to register the GObject type, its signals and properties, etc., is
//! automatically generated.
//!
//! # Syntax overview {#syntax-overview}
//!
...
...
@@ -21,6 +22,7 @@
//! gobject_gen! {
//! class Foo {
//! private_field: Cell<u32>,
//! another_field: RefCell<String>,
//! }
//!
//! // Methods and signals;, their order defines the ABI of your class
...
...
@@ -40,11 +42,38 @@
//! }
//! ```
//!
//! Read on for the details on how to use GObject features.
//! Read on for the details on how to use specific GObject features.
//!
//! # Necessary imports
//!
//! The generated code depends on external crates:
//!
//! * The `glib` crate and its macros.
//! * The `gobject_gen` crate, declaring `proc_macro` use.
//!
//! You can put this at the top of your crate's main file:
//!
//! ```norun
//! #![feature(proc_macro)]
//! extern crate gobject_gen;
//!
//! #[macro_use]
//! extern crate glib;
//!
//! use gobject_gen::gobject_gen;
//! ```
//!
//! You also need the following dependencies in `Cargo.toml`:
//!
//! ```norun
//! [dependencies]
//! glib-sys = "0.6.0"
//! gobject-sys = "0.6.0"
//! libc = "0.2"
//!
//! # Instance-private data
//!
//! GObject classes defined through this macro can have
instance-private data
//! GObject classes defined through this macro can have instance-private data
//! declared as struct fields inside the class.
//!
//! * **Declaration:** Declare struct fields inside `class Foo { ... }`
...
...
@@ -60,20 +89,6 @@
//! data will be `drop()`ed. You can provide `impl Drop` for any fields
//! that need explicit resource management.
//!
//! ## Example: instance-private data with default values
//!
//! ```norun
//! #[derive(Default)]
//! gobject_gen! {
//! class Foo {
//! field_one: Cell<u32>,
//! field_two: Cell<u16>,
//! ...
//! last_field: Cell<u8>
//! }
//! }
//! ```
//!
//! # Declaring methods
//!
//! FIXME
...
...
@@ -86,24 +101,6 @@
//!
//! FIXME
//!
//! # Necessary imports
//!
//! The generated code depends on external crates which you must put in your `Cargo.toml`:
//!
//! * The `glib` crate and its macros.
//! * The `gobject_gen` crate, declaring `proc_macro` use.
//!
//! You can put this at the top of your crate's main file:
//!
//! ```norun
//! #![feature(proc_macro)]
//! extern crate gobject_gen;
//!
//! #[macro_use]
//! extern crate glib;
//!
//! use gobject_gen::gobject_gen;
//! ```
//!
#[macro_use]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment