lib-nested/src/core/view.rs

28 lines
532 B
Rust
Raw Normal View History

2021-01-06 21:35:46 +01:00
/*\
<<<<>>>><<>><><<>><<<*>>><<>><><<>><<<<>>>>
View
<<<<>>>><<>><><<>><<<*>>><<>><><<>><<<<>>>>
\*/
pub trait View : Send + Sync {
/// Notification message for the observers
type Msg;
}
//<<<<>>>><<>><><<>><<<*>>><<>><><<>><<<<>>>>
use std::sync::{Arc, RwLock};
2021-01-19 22:54:50 +01:00
impl<V: View + ?Sized> View for RwLock<V> {
2021-01-06 21:35:46 +01:00
type Msg = V::Msg;
}
2021-01-19 22:54:50 +01:00
impl<V: View + ?Sized> View for Arc<V> {
2021-01-06 21:35:46 +01:00
type Msg = V::Msg;
}
2021-01-19 22:54:50 +01:00
impl<V: View> View for Option<V> {
type Msg = V::Msg;
}
2021-01-06 21:35:46 +01:00