[−][src]Struct mogwai::component::subscriber::Subscriber
A subscriber allows a component to subscribe to other components' messages
without having explicit access to both Transmitter and Receiver. This allows
the parent component to map child component messages into its own updates
without needing its own transmitter. This is good because if send
is called
on a component's own ModelMsg transmitter during its Component::update it
triggers a lock contetion. So a subscriber allows forwarding and wiring
without enabling sending.
Implementations
impl<Msg: Clone + 'static> Subscriber<Msg>
[src]
pub fn new(tx: &Transmitter<Msg>) -> Subscriber<Msg>
[src]
pub fn subscribe_filter_map<ChildMsg, F>(&self, rx: &Receiver<ChildMsg>, f: F) where
F: Fn(&ChildMsg) -> Option<Msg> + 'static,
[src]
F: Fn(&ChildMsg) -> Option<Msg> + 'static,
Subscribe to a receiver by forwarding messages from it using a filter map function.
pub fn subscribe_map<ChildMsg, F>(&self, rx: &Receiver<ChildMsg>, f: F) where
F: Fn(&ChildMsg) -> Msg + 'static,
[src]
F: Fn(&ChildMsg) -> Msg + 'static,
Subscribe to a receiver by forwarding messages from it using a map function.
pub fn subscribe(&self, rx: &Receiver<Msg>)
[src]
Subscribe to a receiver by forwarding messages from it.
pub fn send_async<F>(&self, f: F) where
F: Future<Output = Msg> + 'static,
[src]
F: Future<Output = Msg> + 'static,
Send a one-time asynchronous message.
Trait Implementations
impl<Msg: Clone> Clone for Subscriber<Msg>
[src]
fn clone(&self) -> Subscriber<Msg>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Auto Trait Implementations
impl<Msg> !RefUnwindSafe for Subscriber<Msg>
impl<Msg> !Send for Subscriber<Msg>
impl<Msg> !Sync for Subscriber<Msg>
impl<Msg> Unpin for Subscriber<Msg>
impl<Msg> !UnwindSafe for Subscriber<Msg>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,