Trait otter_api_tests::Downcast [−]
pub trait Downcast: Any { fn into_any(self: Box<Self, Global>) -> Box<dyn Any + 'static, Global>ⓘ; fn into_any_rc(self: Rc<Self>) -> Rc<dyn Any + 'static>; fn as_any(&self) -> &(dyn Any + 'static); fn as_any_mut(&mut self) -> &mut (dyn Any + 'static); }Notable traits for Box<R, Global>
impl<R> Read for Box<R, Global> where
R: Read + ?Sized, impl<W> Write for Box<W, Global> where
W: Write + ?Sized, impl<I, A> Iterator for Box<I, A> where
A: Allocator,
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
A: Allocator + 'static,
F: Future + Unpin + ?Sized, type Output = <F as Future>::Output;
Expand description
Supports conversion to Any
. Traits to be extended by impl_downcast!
must extend Downcast
.
Required methods
fn into_any(self: Box<Self, Global>) -> Box<dyn Any + 'static, Global>ⓘNotable traits for Box<R, Global>
impl<R> Read for Box<R, Global> where
R: Read + ?Sized, impl<W> Write for Box<W, Global> where
W: Write + ?Sized, impl<I, A> Iterator for Box<I, A> where
A: Allocator,
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
A: Allocator + 'static,
F: Future + Unpin + ?Sized, type Output = <F as Future>::Output;
fn into_any(self: Box<Self, Global>) -> Box<dyn Any + 'static, Global>ⓘNotable traits for Box<R, Global>
impl<R> Read for Box<R, Global> where
R: Read + ?Sized, impl<W> Write for Box<W, Global> where
W: Write + ?Sized, impl<I, A> Iterator for Box<I, A> where
A: Allocator,
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
A: Allocator + 'static,
F: Future + Unpin + ?Sized, type Output = <F as Future>::Output;
Convert Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.
fn into_any_rc(self: Rc<Self>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<Self>) -> Rc<dyn Any + 'static>
Convert Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.
Convert &Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert &mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.
Implementors
pub fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>ⓘNotable traits for Box<R, Global>
impl<R> Read for Box<R, Global> where
R: Read + ?Sized, impl<W> Write for Box<W, Global> where
W: Write + ?Sized, impl<I, A> Iterator for Box<I, A> where
A: Allocator,
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
A: Allocator + 'static,
F: Future + Unpin + ?Sized, type Output = <F as Future>::Output;
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)