pub trait Castable:
IDLInterface
+ DomObject
+ Sized {
// Provided methods
fn is<T>(&self) -> bool
where T: DerivedFrom<Self> { ... }
fn upcast<T>(&self) -> &T
where T: Castable,
Self: DerivedFrom<T> { ... }
fn downcast<T>(&self) -> Option<&T>
where T: DerivedFrom<Self> { ... }
}Expand description
A trait to hold the cast functions of IDL interfaces that either derive or are derived from other interfaces.
Provided Methods§
Sourcefn is<T>(&self) -> boolwhere
T: DerivedFrom<Self>,
fn is<T>(&self) -> boolwhere
T: DerivedFrom<Self>,
Check whether a DOM object implements one of its deriving interfaces.
Sourcefn upcast<T>(&self) -> &Twhere
T: Castable,
Self: DerivedFrom<T>,
fn upcast<T>(&self) -> &Twhere
T: Castable,
Self: DerivedFrom<T>,
Cast a DOM object upwards to one of the interfaces it derives from.
Sourcefn downcast<T>(&self) -> Option<&T>where
T: DerivedFrom<Self>,
fn downcast<T>(&self) -> Option<&T>where
T: DerivedFrom<Self>,
Cast a DOM object downwards to one of the interfaces it might implement.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".