2021-01-06 21:35:46 +01:00
|
|
|
|
|
|
|
/*\
|
|
|
|
<<<<>>>><<>><><<>><<<*>>><<>><><<>><<<<>>>>
|
|
|
|
View
|
|
|
|
<<<<>>>><<>><><<>><<<*>>><<>><><<>><<<<>>>>
|
|
|
|
\*/
|
|
|
|
pub trait View : Send + Sync {
|
|
|
|
/// Notification message for the observers
|
2021-05-22 01:33:58 +02:00
|
|
|
type Msg : Send + Sync;
|
2021-01-06 21:35:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
//<<<<>>>><<>><><<>><<<*>>><<>><><<>><<<<>>>>
|
|
|
|
|
2021-03-30 22:47:05 +02:00
|
|
|
use std::sync::Arc;
|
|
|
|
use std::sync::RwLock;
|
2021-01-06 21:35:46 +01:00
|
|
|
|
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
|
|
|
|