[][src]Trait gio::subclass::prelude::ObjectInterface

pub trait ObjectInterface: 'static {
    const NAME: &'static str;

    fn get_type() -> Type;

    fn type_init(_type_: &mut InitializingType<Self>) { ... }
fn interface_init(&mut self) { ... } }

The central trait for defining a GObject interface.

Links together the type name and the interface struct for type registration and allows to hook into various steps of the type registration and initialization.

This must only be implemented on #[repr(C)] structs and have gobject_sys::GTypeInterface as the first field.

See register_interface for registering an implementation of this trait with the type system.

Associated Constants

const NAME: &'static str

GObject type name.

This must be unique in the whole process.

Loading content...

Required methods

fn get_type() -> Type

Returns the glib::Type ID of the interface.

This will register the type with the type system on the first call and is usually generated by the glib_object_interface! macro.

Loading content...

Provided methods

fn type_init(_type_: &mut InitializingType<Self>)

Additional type initialization.

This is called right after the type was registered and allows interfaces to do additional type-specific initialization, e.g. for adding prerequisites.

Optional

fn interface_init(&mut self)

Interface initialization.

This is called after type_init and before the first implementor of the interface is created. Interfaces can use this to do interface- specific initialization, e.g. for installing properties or signals on the interface, and for setting default implementations of interface functions.

Optional

Loading content...

Implementors

Loading content...