Struct medea_jason::utils::component::Component
source · pub struct Component<S, O> { /* private fields */ }
Expand description
Component is a base that helps managing reactive components.
It consists of two parts: state and object. Object is listening to its state changes and updates accordingly, so all mutations are meant to be applied to the state.
Implementations§
source§impl<S: ComponentState<O> + 'static, O: 'static> Component<S, O>
impl<S: ComponentState<O> + 'static, O: 'static> Component<S, O>
source§impl Component<State, Repository>
impl Component<State, Repository>
sourcepub fn get(&self, id: PeerId) -> Option<Rc<PeerConnection>>
pub fn get(&self, id: PeerId) -> Option<Rc<PeerConnection>>
Returns PeerConnection
stored in the repository by its ID.
sourcepub fn get_all(&self) -> Vec<Rc<PeerConnection>>
pub fn get_all(&self) -> Vec<Rc<PeerConnection>>
Returns all PeerConnection
s stored in the repository.
sourcepub fn connection_lost(&self)
pub fn connection_lost(&self)
Notifies all peer::Component
s about a RPC connection loss.
sourcepub fn connection_recovered(&self)
pub fn connection_recovered(&self)
Notifies all peer::Component
s about a RPC connection restore.
sourcepub fn apply(&self, new_state: Room)
pub fn apply(&self, new_state: Room)
Updates this State
with the provided proto::state::Room
.
Trait Implementations§
source§impl ComponentState<<Component<State, PeerConnection> as ComponentTypes>::Obj> for <Component as ComponentTypes>::State
impl ComponentState<<Component<State, PeerConnection> as ComponentTypes>::Obj> for <Component as ComponentTypes>::State
source§fn spawn_watchers(
&self,
s: &mut WatchersSpawner<Self, <Component as ComponentTypes>::Obj>
)
fn spawn_watchers( &self, s: &mut WatchersSpawner<Self, <Component as ComponentTypes>::Obj> )
Spawns all watchers required for this
ComponentState
.source§impl ComponentState<<Component<State, Receiver> as ComponentTypes>::Obj> for <Component as ComponentTypes>::State
impl ComponentState<<Component<State, Receiver> as ComponentTypes>::Obj> for <Component as ComponentTypes>::State
source§fn spawn_watchers(
&self,
s: &mut WatchersSpawner<Self, <Component as ComponentTypes>::Obj>
)
fn spawn_watchers( &self, s: &mut WatchersSpawner<Self, <Component as ComponentTypes>::Obj> )
Spawns all watchers required for this
ComponentState
.source§impl ComponentState<<Component<State, Repository> as ComponentTypes>::Obj> for <Component as ComponentTypes>::State
impl ComponentState<<Component<State, Repository> as ComponentTypes>::Obj> for <Component as ComponentTypes>::State
source§fn spawn_watchers(
&self,
s: &mut WatchersSpawner<Self, <Component as ComponentTypes>::Obj>
)
fn spawn_watchers( &self, s: &mut WatchersSpawner<Self, <Component as ComponentTypes>::Obj> )
Spawns all watchers required for this
ComponentState
.source§impl ComponentState<<Component<State, Sender> as ComponentTypes>::Obj> for <Component as ComponentTypes>::State
impl ComponentState<<Component<State, Sender> as ComponentTypes>::Obj> for <Component as ComponentTypes>::State
source§fn spawn_watchers(
&self,
s: &mut WatchersSpawner<Self, <Component as ComponentTypes>::Obj>
)
fn spawn_watchers( &self, s: &mut WatchersSpawner<Self, <Component as ComponentTypes>::Obj> )
Spawns all watchers required for this
ComponentState
.source§impl<S, O> ComponentTypes for Component<S, O>
impl<S, O> ComponentTypes for Component<S, O>
Auto Trait Implementations§
impl<S, O> !RefUnwindSafe for Component<S, O>
impl<S, O> !Send for Component<S, O>
impl<S, O> !Sync for Component<S, O>
impl<S, O> Unpin for Component<S, O>
impl<S, O> !UnwindSafe for Component<S, O>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more