1 2 3 4 5 6 7 8 9 10 11 12 13
pub trait State: 'static + Send + Sized {} pub trait Model: 'static + Send + Sync + Sized { type State: State; fn new_state(&self) -> Self::State; } impl Model for () { type State = (); fn new_state(&self) -> Self::State {} } impl<T: 'static + Send + Sized> State for T {}