pub trait AnyView {
    fn as_any(&self) -> &dyn Any;
    fn as_any_mut(&mut self) -> &mut dyn Any;
    fn as_boxed_any(self: Box<Self>) -> Box<dyn Any>;
}
Expand description

A view that can be downcasted to its concrete type.

This trait is automatically implemented for any T: View.

Required Methods§

Downcast self to a Any.

Downcast self to a mutable Any.

Returns a boxed any from a boxed self.

Can be used before Box::downcast().

Examples
let boxed: Box<dyn View> = Box::new(TextView::new("text"));
let text: Box<TextView> = boxed.as_boxed_any().downcast().unwrap();

Implementations§

Attempts to downcast self to a concrete type.

Attempts to downcast self to a concrete type.

Attempts to downcast Box<Self> to a concrete type.

Checks if this view is of type T.

Implementors§