wrap.rs (383B)
1 use std::ops::Deref; 2 3 #[derive(Clone, Copy)] 4 pub struct State<T: Send + Sync>(pub(crate) T); 5 6 impl<T> Deref for State<T> 7 where 8 T: Send + Sync, 9 { 10 type Target = T; 11 12 fn deref(&self) -> &T { 13 &self.0 14 } 15 } 16 17 #[derive(Clone)] 18 pub struct MsgContent(pub String); 19 20 impl Deref for MsgContent { 21 type Target = str; 22 23 fn deref(&self) -> &str { 24 &self.0 25 } 26 }