Trait DowncastFrom

Source
pub trait DowncastFrom<T>: Sized {
    // Required method
    fn downcast_from(t: &T) -> Option<Self>;
}
Expand description

Our version of “try-from”. A “downcast” casts from a more general type (e.g., any Parameter) to a more specific type (e.g., a type). This returns an Option because the value may not be an instance of the more specific type.

Required Methods§

Source

fn downcast_from(t: &T) -> Option<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.

Implementations on Foreign Types§

Source§

impl<A, B, A1, B1> DowncastFrom<(A1, B1)> for (A, B)
where A: DowncastFrom<A1>, B: DowncastFrom<B1>,

Source§

impl<A, B, C, A1, B1, C1> DowncastFrom<(A1, B1, C1)> for (A, B, C)
where A: DowncastFrom<A1>, B: DowncastFrom<B1>, C: DowncastFrom<C1>,

Source§

impl<T, U> DowncastFrom<Option<U>> for Option<T>
where T: DowncastFrom<U>,

Source§

fn downcast_from(u: &Option<U>) -> Option<Self>

Source§

impl<T, U> DowncastFrom<Arc<U>> for Arc<T>
where T: DowncastFrom<U>,

Source§

fn downcast_from(u: &Arc<U>) -> Option<Self>

Implementors§

Source§

impl<A, B> DowncastFrom<BTreeSet<A>> for Set<B>
where A: Ord, B: DowncastFrom<A> + Ord,

Source§

impl<T, U> DowncastFrom<T> for U
where T: DowncastTo<U>,