|
|
@ -180,13 +180,14 @@ pub trait AnyComponent {
|
|
|
|
/// Returns a boxed any from a boxed self.
|
|
|
|
/// Returns a boxed any from a boxed self.
|
|
|
|
///
|
|
|
|
///
|
|
|
|
/// Can be used before `Box::downcast()`.
|
|
|
|
/// Can be used before `Box::downcast()`.
|
|
|
|
//
|
|
|
|
///
|
|
|
|
// # Examples
|
|
|
|
/// # Examples
|
|
|
|
//
|
|
|
|
///
|
|
|
|
// ```rust
|
|
|
|
/// ```rust
|
|
|
|
// let boxed: Box<Component> = Box::new(TextComponent::new("text"));
|
|
|
|
/// use helix_term::{ui::Text, compositor::Component};
|
|
|
|
// let text: Box<TextComponent> = boxed.as_boxed_any().downcast().unwrap();
|
|
|
|
/// let boxed: Box<Component> = Box::new(Text::new("text".to_string()));
|
|
|
|
// ```
|
|
|
|
/// let text: Box<Text> = boxed.as_boxed_any().downcast().unwrap();
|
|
|
|
|
|
|
|
/// ```
|
|
|
|
fn as_boxed_any(self: Box<Self>) -> Box<dyn Any>;
|
|
|
|
fn as_boxed_any(self: Box<Self>) -> Box<dyn Any>;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|