[−][src]Trait cursive::view::AnyView
A view that can be downcasted to its concrete type.
This trait is automatically implemented for any T: View
.
Required methods
fn as_any(&self) -> &dyn Any
Downcast self to a Any
.
fn as_any_mut(&mut self) -> &mut dyn Any
Downcast self to a mutable Any
.
fn as_boxed_any(self: Box<Self>) -> Box<dyn Any>
Returns a boxed any from a boxed self.
Can be used before Box::downcast()
.
Examples
let boxed: Box<View> = Box::new(TextView::new("text")); let text: Box<TextView> = boxed.as_boxed_any().downcast().unwrap();
Methods
impl dyn AnyView
[src]
pub fn downcast_ref<T: Any>(&self) -> Option<&T>
[src]
Attempts to downcast self
to a concrete type.
pub fn downcast_mut<T: Any>(&mut self) -> Option<&mut T>
[src]
Attempts to downcast self
to a concrete type.
pub fn downcast<T: Any>(self: Box<Self>) -> Result<Box<T>, Box<Self>>
[src]
Attempts to downcast Box<Self>
to a concrete type.