Trait libpanel::subclass::prelude::InstanceStruct
source · pub unsafe trait InstanceStruct: Sized + 'static {
type Type: ObjectSubclass;
// Provided methods
fn imp(&self) -> &Self::Type { ... }
fn class(&self) -> &<Self::Type as ObjectSubclass>::Class { ... }
fn instance_init(&mut self) { ... }
}
Expand description
Trait implemented by structs that implement a GObject
C instance struct.
The struct must be #[repr(C)]
and have the parent type’s instance struct
as the first field.
See basic::InstanceStruct
for a basic implementation of this that can
be used most of the time and should only not be used if additional fields are
required in the instance struct.
Required Associated Types§
sourcetype Type: ObjectSubclass
type Type: ObjectSubclass
Corresponding object subclass type for this instance struct.
Provided Methods§
sourcefn imp(&self) -> &Self::Type
fn imp(&self) -> &Self::Type
Returns the implementation for from this instance struct, that
is the implementor of ObjectImpl
or subtraits.
sourcefn class(&self) -> &<Self::Type as ObjectSubclass>::Class
fn class(&self) -> &<Self::Type as ObjectSubclass>::Class
Returns the class struct for this specific instance.
sourcefn instance_init(&mut self)
fn instance_init(&mut self)
Instance specific initialization.
This is automatically called during instance initialization and must call instance_init()
of the parent class.