Skip to main content

Downcast

Trait Downcast 

Source
pub trait Downcast<T: ?Sized>: Sized {
    type Wrapped;

    // Required method
    fn downcast(self) -> Result<Self::Wrapped, Self>;
}
Expand description

Any wrapper around a class that can be downcast into a child class.

Required Associated Types§

Required Methods§

Source

fn downcast(self) -> Result<Self::Wrapped, Self>

Downcast into a child class. Returns Err(self) if the cast is invalid.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<T: ?Sized + Class, U: ?Sized + Class> Downcast<U> for ClassBox<T>
where for<'a> &'a mut T: Downcast<U, Wrapped = &'a mut U>,