glib::subclass::types

Trait ObjectSubclassExt

Source
pub trait ObjectSubclassExt: ObjectSubclass {
    // Required methods
    fn instance(&self) -> BorrowedObject<'_, Self::Type>;
    fn from_instance(obj: &Self::Type) -> &Self;
    fn obj(&self) -> BorrowedObject<'_, Self::Type>;
    fn from_obj(obj: &Self::Type) -> &Self;
    fn ref_counted(&self) -> ObjectImplRef<Self>;
    fn instance_data<U: Any + Send + Sync + 'static>(
        &self,
        type_: Type,
    ) -> Option<&U>;
}
Expand description

Extension methods for all ObjectSubclass impls.

Required Methods§

Source

fn instance(&self) -> BorrowedObject<'_, Self::Type>

👎Deprecated: Use obj() instead

Returns the corresponding object instance.

Source

fn from_instance(obj: &Self::Type) -> &Self

👎Deprecated: Use from_obj() instead

Returns the implementation from an instance.

Source

fn obj(&self) -> BorrowedObject<'_, Self::Type>

Returns the corresponding object instance.

Shorter alias for instance().

Source

fn from_obj(obj: &Self::Type) -> &Self

Returns the implementation from an instance.

Shorter alias for from_instance().

Source

fn ref_counted(&self) -> ObjectImplRef<Self>

Returns a new reference-counted wrapper around self.

Source

fn instance_data<U: Any + Send + Sync + 'static>( &self, type_: Type, ) -> Option<&U>

Returns a pointer to the instance implementation specific data.

This is used for the subclassing infrastructure to store additional instance data.

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.

Implementors§