pub trait DowncastTo<T>: Sized {
    // Required method
    fn downcast_to(&self) -> Option<T>;
}
Expand description

Our version of “try-into”. A “downcast” casts from a more general type (e.g., any Parameter) to a more specific type (e.g., a type).

This is the trait that you prefer to implement, but use DowncastFrom in where-clauses.

Required Methods§

source

fn downcast_to(&self) -> Option<T>

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl DowncastTo<u32> for u32

source§

impl DowncastTo<()> for ()

source§

impl DowncastTo<usize> for usize

source§

impl DowncastTo<String> for String

source§

impl<A, B> DowncastTo<Vec<B>> for Vec<A>
where B: DowncastFrom<A>,

source§

fn downcast_to(&self) -> Option<Vec<B>>

source§

impl<A, T> DowncastTo<(A, Vec<T>)> for Vec<T>
where A: DowncastFrom<T>, T: Ord + Clone,

source§

fn downcast_to(&self) -> Option<(A, Vec<T>)>

source§

impl<T> DowncastTo<()> for Vec<T>

source§

impl<T, U> DowncastTo<T> for &U
where T: DowncastFrom<U> + Clone,

source§

fn downcast_to(&self) -> Option<T>

Implementors§