lib-nested/nested/src/core/view.rs

27 lines
555 B
Rust
Raw Normal View History

2022-05-08 23:30:49 +02:00
/*\
2021-01-06 21:35:46 +01:00
<<<<>>>><<>><><<>><<<*>>><<>><><<>><<<<>>>>
View
<<<<>>>><<>><><<>><<<*>>><<>><><<>><<<<>>>>
\*/
2021-11-19 12:19:52 +01:00
pub trait View: Send + Sync {
2021-01-06 21:35:46 +01:00
/// Notification message for the observers
2021-11-19 12:19:52 +01:00
type Msg: Send + Sync;
2021-01-06 21:35:46 +01: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;
}