|0.8.2||Sep 23, 2019|
|0.8.1||Jul 17, 2019|
|0.8.0||Jun 22, 2019|
|0.7.1||Feb 25, 2019|
|0.0.3||Jul 18, 2015|
#3 in GUI
11,917 downloads per month
Used in 138 crates (80 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.