cursive 0.3.6

A TUI (Text User Interface) library focused on ease-of-use.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use view::View;
use views::IdView;

/// Makes a view wrappable in an [`IdView`].
///
/// [`IdView`]: ../views/struct.IdView.html
pub trait Identifiable: View + Sized {
    /// Wraps this view into an IdView with the given id.
    ///
    /// This is just a shortcut for `IdView::new(id, self)`
    fn with_id(self, id: &str) -> IdView<Self> {
        IdView::new(id, self)
    }
}

/// Any `View` implements this trait.
impl<T: View> Identifiable for T {}