mirror of
https://github.com/FliegendeWurst/cursive.git
synced 2024-11-15 13:43:08 +00:00
15 lines
350 B
Rust
15 lines
350 B
Rust
|
use views::IdView;
|
||
|
use view::View;
|
||
|
|
||
|
/// 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.
|
||
|
fn with_id(self, id: &str) -> IdView<Self> {
|
||
|
IdView::new(id, self)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
impl<T: View> Identifiable for T {}
|