[][src]Trait cursive_core::view::AnyView

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

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[src]

Downcast self to a Any.

pub fn as_any_mut(&mut self) -> &mut dyn Any[src]

Downcast self to a mutable Any.

pub fn as_boxed_any(self: Box<Self>) -> Box<dyn Any>[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();
Loading content...

Implementations

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.

pub fn is<T: Any>(&mut self) -> bool[src]

Checks if this view is of type T.

Implementors

impl<T: View> AnyView for T[src]

pub fn as_any(&self) -> &dyn Any[src]

Downcast self to a Any.

pub fn as_any_mut(&mut self) -> &mut dyn Any[src]

Downcast self to a mutable Any.

Loading content...