|0.7.1||Feb 25, 2019|
|0.6.1||Dec 14, 2018|
|0.6.0||Sep 9, 2018|
|0.5.0||Mar 17, 2018|
|0.0.3||Jul 18, 2015|
#4 in GUI
12,501 downloads per month
Used in 126 crates (75 directly)
GLib bindings for Rust.
Alongside GLib bindings, this crate also includes the infrastructure to
GObject for extending libraries like GTK+. A code example can
be found in the documentation of this crate in the
This library contains
bindings to some essential GLib, GObject, GIO types and APIs,
common building blocks used in both handmade and machine generated bindings to GTK+ and other GLib-based libraries.
It is the foundation for higher level libraries with uniform Rusty (safe and strongly typed) APIs. It avoids exposing GLib-specific data types where possible and is not meant to provide comprehensive GLib bindings, which would often amount to duplicating the Rust Standard Library or other utility crates.
The library is a work in progress: expect missing functionality and breaking changes.
Value can carry values of any
Variant can carry values of
Each class and interface has a corresponding smart pointer struct
representing an instance of that type (e.g.
GtkWidget). They are reference counted and feature
interior mutability similarly to Rust's
Consequently, cloning objects is cheap and their methods never require
mutable borrows. Two smart pointers are equal iff they point to the same
Interfaces and non-leaf classes also have corresponding traits (e.g.
gtk::WidgetExt), which are blanketly implemented for all
For creating new subclasses of
Object or other object types this crate has to be compiled
subclassing feature to enable the
subclass module. Check
the module's documentation for further details and a code example.
GLib-based libraries largely operate on pointers to various boxed or
reference counted structures so the bindings have to implement corresponding
smart pointers (wrappers), which encapsulate resource management and safety
checks. Such wrappers are defined via the
glib_wrapper! macro, which uses abstractions
defined in the
translate module defines and partly implements
conversions between high level Rust types (including the aforementioned
wrappers) and their FFI counterparts.