Trait ObjectConstraint
pub unsafe trait ObjectConstraint:
MetaclassConstraint
+ Inherits<Object>
+ Inheritable {
// Provided methods
fn downcast<T>(self) -> Result<Option<T>, Error>
where T: MetaInherits<Self> { ... }
fn downcast_ref<T>(&self) -> Result<Option<&T>, Error>
where T: MetaInherits<Self> { ... }
fn is_a<T>(&self) -> Result<bool, Error>
where T: MetaInherits<Self> { ... }
fn downgrade(self) -> Weak<Self> { ... }
fn downgrade_ref(&self) -> Weak<Self> { ... }
fn lock(self) -> ThreadObject<Self> { ... }
fn lock_ref(&self) -> ThreadObject<Self> { ... }
}Expand description
Used for statically marking all classes which derive from Object.
Provides a way for downcasting objects to more specific types.
§Safety
ObjectConstraint is an internal trait and shouldn’t be implemented by users directly.
This trait should only be implemented for classes deriving from Object.
Provided Methods§
fn downcast<T>(self) -> Result<Option<T>, Error>where
T: MetaInherits<Self>,
fn downcast<T>(self) -> Result<Option<T>, Error>where
T: MetaInherits<Self>,
Casts metaclass to a more specific type by value.
fn downcast_ref<T>(&self) -> Result<Option<&T>, Error>where
T: MetaInherits<Self>,
fn downcast_ref<T>(&self) -> Result<Option<&T>, Error>where
T: MetaInherits<Self>,
Casts metaclass to a more specific type by reference.
fn is_a<T>(&self) -> Result<bool, Error>where
T: MetaInherits<Self>,
fn is_a<T>(&self) -> Result<bool, Error>where
T: MetaInherits<Self>,
Determines whether the class this metaclass describes derives from a class described by specified metaclass.
fn downgrade(self) -> Weak<Self>
fn downgrade_ref(&self) -> Weak<Self>
fn lock(self) -> ThreadObject<Self>
fn lock_ref(&self) -> ThreadObject<Self>
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.