pub unsafe trait ClassStruct: Sized + 'static {
type Type: ObjectSubclass;
// Provided method
fn class_init(&mut self) { ... }
}
Expand description
Trait implemented by structs that implement a GObject
C class struct.
The struct must be #[repr(C)]
and have the parent type’s class struct
as the first field.
See basic::ClassStruct
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 class struct, e.g. for declaring new virtual methods.
Required Associated Types§
Sourcetype Type: ObjectSubclass
type Type: ObjectSubclass
Corresponding object subclass type for this class struct.
Provided Methods§
Sourcefn class_init(&mut self)
fn class_init(&mut self)
Override the vfuncs of all parent types.
This is automatically called during type initialization.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.