Crate glib_macros
source ·Macros
- Macro for passing variables as strong or weak references into a closure.
- Macro for creating a
Closure
object. This is a wrapper aroundClosure::new
that automatically type checks its arguments at run-time. - The same as
closure!
but usesClosure::new_local
as a constructor. This is useful for closures which can’t be sent across threads. See the documentation ofclosure!
for details.
Attribute Macros
- Attribute macro for defining flags using the
bitflags
crate. This macro will also define aGFlags::type_
function and theglib::Value
traits. - Macro for boilerplate of
ObjectInterface
implementations. - Macro for boilerplate of
ObjectSubclass
implementations.
Derive Macros
- Derive macro for defining a
BoxedType
::type_
function and theglib::Value
traits. Optionally, the type can be marked asnullable
to get an implemention ofglib::value::ToValueOptional
. - Macro for deriving implementations of
glib::clone::Downgrade
andglib::clone::Upgrade
traits and a weak type. - Derive macro for register a rust enum in the glib type system and derive the the
glib::Value
traits. - Derive macro for defining a GLib error domain and its associated
ErrorDomain
trait. - This macro enables you to derive object properties in a quick way.
- Derive macro for defining a
SharedType
::get_type
function and theglib::Value
traits. Optionally, the type can be marked asnullable
to get an implemention ofglib::value::ToValueOptional
. - Example
- Derive macro for serializing/deserializing custom structs/enums as
glib::Variant
s.