Trait cursive::view::AnyView [−][src]
A view that can be downcasted to its concrete type.
This trait is automatically implemented for any T: View
.
Required methods
pub fn as_any(&self) -> &(dyn Any + 'static)
[src]
Downcast self to a Any
.
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
[src]
Downcast self to a mutable Any
.
pub fn as_boxed_any(self: Box<Self, Global>) -> Box<dyn Any + 'static, Global>
[src]
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();
Implementations
impl dyn AnyView + 'static
[src]
pub fn downcast_ref<T>(&self) -> Option<&T> where
T: Any,
[src]
T: Any,
Attempts to downcast self
to a concrete type.
pub fn downcast_mut<T>(&mut self) -> Option<&mut T> where
T: Any,
[src]
T: Any,
Attempts to downcast self
to a concrete type.
pub fn downcast<T>(
self: Box<dyn AnyView + 'static, Global>
) -> Result<Box<T, Global>, Box<dyn AnyView + 'static, Global>> where
T: Any,
[src]
self: Box<dyn AnyView + 'static, Global>
) -> Result<Box<T, Global>, Box<dyn AnyView + 'static, Global>> where
T: Any,
Attempts to downcast Box<Self>
to a concrete type.
pub fn is<T>(&mut self) -> bool where
T: Any,
[src]
T: Any,
Checks if this view is of type T
.