Trait gtk::prelude::IsClassFor
source · [−]pub unsafe trait IsClassFor: 'static {
type Instance: ObjectType;
fn get_type(&self) -> Type { ... }
fn upcast_ref<U>(&self) -> &U
where
U: IsClassFor,
Self::Instance: IsA<<U as IsClassFor>::Instance>,
<U as IsClassFor>::Instance: ObjectType,
{ ... }
fn upcast_ref_mut<U>(&mut self) -> &mut U
where
U: IsClassFor,
Self::Instance: IsA<<U as IsClassFor>::Instance>,
<U as IsClassFor>::Instance: ObjectType,
{ ... }
fn downcast_ref<U>(&self) -> Option<&U>
where
U: IsClassFor,
<U as IsClassFor>::Instance: IsA<Self::Instance>,
Self::Instance: ObjectType,
{ ... }
fn downcast_ref_mut<U>(&mut self) -> Option<&mut U>
where
U: IsClassFor,
<U as IsClassFor>::Instance: IsA<Self::Instance>,
Self::Instance: ObjectType,
{ ... }
fn from_type(type_: Type) -> Option<ClassRef<Self>> { ... }
}Expand description
Trait for mapping a class struct type to its corresponding instance type.
Required Associated Types
sourcetype Instance: ObjectType
type Instance: ObjectType
Corresponding Rust instance type for this class.
Provided Methods
sourcefn upcast_ref<U>(&self) -> &Uwhere
U: IsClassFor,
Self::Instance: IsA<<U as IsClassFor>::Instance>,
<U as IsClassFor>::Instance: ObjectType,
fn upcast_ref<U>(&self) -> &Uwhere
U: IsClassFor,
Self::Instance: IsA<<U as IsClassFor>::Instance>,
<U as IsClassFor>::Instance: ObjectType,
Casts this class to a reference to a parent type’s class.
sourcefn upcast_ref_mut<U>(&mut self) -> &mut Uwhere
U: IsClassFor,
Self::Instance: IsA<<U as IsClassFor>::Instance>,
<U as IsClassFor>::Instance: ObjectType,
fn upcast_ref_mut<U>(&mut self) -> &mut Uwhere
U: IsClassFor,
Self::Instance: IsA<<U as IsClassFor>::Instance>,
<U as IsClassFor>::Instance: ObjectType,
Casts this class to a mutable reference to a parent type’s class.
sourcefn downcast_ref<U>(&self) -> Option<&U>where
U: IsClassFor,
<U as IsClassFor>::Instance: IsA<Self::Instance>,
Self::Instance: ObjectType,
fn downcast_ref<U>(&self) -> Option<&U>where
U: IsClassFor,
<U as IsClassFor>::Instance: IsA<Self::Instance>,
Self::Instance: ObjectType,
Casts this class to a reference to a child type’s class or fails if this class is not implementing the child class.
sourcefn downcast_ref_mut<U>(&mut self) -> Option<&mut U>where
U: IsClassFor,
<U as IsClassFor>::Instance: IsA<Self::Instance>,
Self::Instance: ObjectType,
fn downcast_ref_mut<U>(&mut self) -> Option<&mut U>where
U: IsClassFor,
<U as IsClassFor>::Instance: IsA<Self::Instance>,
Self::Instance: ObjectType,
Casts this class to a mutable reference to a child type’s class or fails if this class is not implementing the child class.