Macro downcast::downcast_methods
[−]
[src]
macro_rules! downcast_methods { ($($tt:tt)+) => { ... }; }
Generate downcast
-methods for your trait-object-type.
downcast_methods!(Foo); downcast_methods!(<B> Foo<B> where B: Bar); downcast_methods!(<B> Foo<Bar = B>);
/* 1st */ impl Foo { /* 2nd */ impl<B> Foo<B> where B: Bar { /* 3nd */ impl<B> Foo<Bar = B> { pub fn is<T>(&self) -> bool where T: Any, Self: Downcast<T> { ... } pub unsafe fn downcast_ref_unchecked<T>(&self) -> &T where T: Any, Self: Downcast<T> { ... } pub fn downcast_ref<T>(&self) -> Result<&T, TypeMismatch> where T: Any, Self: Downcast<T> { ... } pub unsafe fn downcast_mut_unchecked<T>(&mut self) -> &mut T where T: Any, Self: Downcast<T> { ... } pub fn downcast_mut<T>(&mut self) -> Result<&mut T, TypeMismatch> where T: Any, Self: Downcast<T> { ... } pub unsafe fn downcast_unchecked<T>(self: Box<Self>) -> Box<T> where T: Any, Self: Downcast<T> { ... } pub fn downcast<T>(self: Box<Self>) -> Result<Box<T>, DowncastError<Box<T>>> where T: Any, Self: Downcast<T> { ... } }