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
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.
Traits and essential types intended for blanket imports.
Translation between GLib/GLib-based FFI types and their Rust counterparts.
Runtime type information.
Wrapper implementations for Boxed types. See
Wrapper implementations for Object types. See
Wrapper implementations for shared types. See
Defines a wrapper type and implements the appropriate traits.
Adds a closure to be called by the default main loop when it's idle.
Removes the source with the given id
Adds a closure to be called by the default main loop at regular intervals with millisecond granularity.
Adds a closure to be called by the default main loop at regular intervals with second granularity.