[−][src]Struct mogwai::txrx::Receiver
Receive messages instantly.
Implementations
impl<A> Receiver<A>
[src]
pub fn new() -> Receiver<A>
[src]
Create a new Receiver.
pub fn respond<F>(self, f: F) where
F: FnMut(&A) + 'static,
[src]
F: FnMut(&A) + 'static,
Set the response this receiver has to messages. Upon receiving a message the response will run immediately.
pub fn respond_shared<T: 'static, F>(self, val: Rc<RefCell<T>>, f: F) where
F: Fn(&mut T, &A) + 'static,
[src]
F: Fn(&mut T, &A) + 'static,
Set the response this receiver has to messages. Upon receiving a message the response will run immediately.
Folds mutably over a Rc<RefCell
pub fn drop_responder(&self)
[src]
Removes the responder from the receiver. This drops anything owned by the responder.
pub fn new_trns(&self) -> Transmitter<A>
[src]
Spawn a new Transmitter
that sends to this Receiver.
pub fn branch(&self) -> Receiver<A>
[src]
Branch a receiver off of the original. Each branch will receive from the same transmitter. The new branch has no initial response to messages.
pub fn branch_filter_fold<B, X, T, F>(&self, init: X, f: F) -> Receiver<B> where
B: 'static,
X: Into<T>,
T: 'static,
F: Fn(&mut T, &A) -> Option<B> + 'static,
[src]
B: 'static,
X: Into<T>,
T: 'static,
F: Fn(&mut T, &A) -> Option<B> + 'static,
Branch a new receiver off of an original and wire any messages sent to the original by using a stateful fold function.
The fold function returns an Option<B>
. In the case that the value of
Option<B>
is None
, no message will be sent to the new receiver.
Each branch will receive from the same transmitter.
pub fn branch_filter_fold_shared<B, T, F>(
&self,
state: Rc<RefCell<T>>,
f: F
) -> Receiver<B> where
B: 'static,
T: 'static,
F: Fn(&mut T, &A) -> Option<B> + 'static,
[src]
&self,
state: Rc<RefCell<T>>,
f: F
) -> Receiver<B> where
B: 'static,
T: 'static,
F: Fn(&mut T, &A) -> Option<B> + 'static,
Branch a new receiver off of an original and wire any messages sent to the original by using a stateful fold function, where the state is a shared mutex.
The fold function returns an Option<B>
. In the case that the value of
Option<B>
is None
, no message will be sent to the new receiver.
Each branch will receive from the same transmitter.
pub fn branch_fold<B, X, T, F>(&self, init: X, f: F) -> Receiver<B> where
B: 'static,
X: Into<T>,
T: 'static,
F: Fn(&mut T, &A) -> B + 'static,
[src]
B: 'static,
X: Into<T>,
T: 'static,
F: Fn(&mut T, &A) -> B + 'static,
Branch a new receiver off of an original and wire any messages sent to the original by using a stateful fold function.
All output of the fold function is sent to the new receiver.
Each branch will receive from the same transmitter(s).
pub fn branch_fold_shared<B, T, F>(
&self,
t: Rc<RefCell<T>>,
f: F
) -> Receiver<B> where
B: 'static,
T: 'static,
F: Fn(&mut T, &A) -> B + 'static,
[src]
&self,
t: Rc<RefCell<T>>,
f: F
) -> Receiver<B> where
B: 'static,
T: 'static,
F: Fn(&mut T, &A) -> B + 'static,
Branch a new receiver off of an original and wire any messages sent to the original by using a stateful fold function, where the state is a shared mutex.
All output of the fold function is sent to the new receiver.
Each branch will receive from the same transmitter(s).
pub fn branch_filter_map<B, F>(&self, f: F) -> Receiver<B> where
B: 'static,
F: Fn(&A) -> Option<B> + 'static,
[src]
B: 'static,
F: Fn(&A) -> Option<B> + 'static,
Branch a new receiver off of an original and wire any messages sent to the original by using a stateless map function.
The map function returns an Option<B>
, representing an optional message
to send to the new receiver.
In the case that the result value of the map function is None
, no message
will be sent to the new receiver.
Each branch will receive from the same transmitter.
pub fn branch_map<B, F>(&self, f: F) -> Receiver<B> where
B: 'static,
F: Fn(&A) -> B + 'static,
[src]
B: 'static,
F: Fn(&A) -> B + 'static,
Branch a new receiver off of an original and wire any messages sent to the original by using a stateless map function.
All output of the map function is sent to the new receiver.
Each branch will receive from the same transmitter.
pub fn forward_filter_fold_shared<B, T, F>(
self,
tx: &Transmitter<B>,
var: Rc<RefCell<T>>,
f: F
) where
B: 'static,
T: 'static,
F: Fn(&mut T, &A) -> Option<B> + 'static,
[src]
self,
tx: &Transmitter<B>,
var: Rc<RefCell<T>>,
f: F
) where
B: 'static,
T: 'static,
F: Fn(&mut T, &A) -> Option<B> + 'static,
Forwards messages on the given receiver to the given transmitter using a stateful fold function, where the state is a shared mutex.
The fold function returns an Option<B>
. In the case that the value of
Option<B>
is None
, no message will be sent to the transmitter.
pub fn forward_filter_fold<B, X, T, F>(self, tx: &Transmitter<B>, init: X, f: F) where
B: 'static,
T: 'static,
X: Into<T>,
F: Fn(&mut T, &A) -> Option<B> + 'static,
[src]
B: 'static,
T: 'static,
X: Into<T>,
F: Fn(&mut T, &A) -> Option<B> + 'static,
Forwards messages on the given receiver to the given transmitter using a stateful fold function.
The fold function returns an Option<B>
. In the case that the value of
Option<B>
is None
, no message will be sent to the transmitter.
pub fn forward_fold<B, X, T, F>(self, tx: &Transmitter<B>, init: X, f: F) where
B: 'static,
T: 'static,
X: Into<T>,
F: Fn(&mut T, &A) -> B + 'static,
[src]
B: 'static,
T: 'static,
X: Into<T>,
F: Fn(&mut T, &A) -> B + 'static,
Forwards messages on the given receiver to the given transmitter using a stateful fold function. All output of the fold function is sent to the given transmitter.
pub fn forward_fold_shared<B, T, F>(
self,
tx: &Transmitter<B>,
t: Rc<RefCell<T>>,
f: F
) where
B: 'static,
T: 'static,
F: Fn(&mut T, &A) -> B + 'static,
[src]
self,
tx: &Transmitter<B>,
t: Rc<RefCell<T>>,
f: F
) where
B: 'static,
T: 'static,
F: Fn(&mut T, &A) -> B + 'static,
Forwards messages on the given receiver to the given transmitter using a stateful fold function, where the state is a shared mutex. All output of the fold function is sent to the given transmitter.
pub fn forward_filter_map<B, F>(self, tx: &Transmitter<B>, f: F) where
B: 'static,
F: Fn(&A) -> Option<B> + 'static,
[src]
B: 'static,
F: Fn(&A) -> Option<B> + 'static,
Forwards messages on the given receiver to the given transmitter using a
stateless map function. If the map function returns None
for any messages
those messages will not be sent to the given transmitter.
pub fn forward_map<B, F>(self, tx: &Transmitter<B>, f: F) where
B: 'static,
F: Fn(&A) -> B + 'static,
[src]
B: 'static,
F: Fn(&A) -> B + 'static,
Forwards messages on the given receiver to the given transmitter using a stateless map function. All output of the map function is sent to the given transmitter.
pub fn forward_filter_fold_async<T, B, X, F, H>(
self,
tb: &Transmitter<B>,
init: X,
f: F,
h: H
) where
B: 'static,
T: 'static,
X: Into<T>,
F: Fn(&mut T, &A) -> Option<RecvFuture<B>> + 'static,
H: Fn(&mut T, &Option<B>) + 'static,
[src]
self,
tb: &Transmitter<B>,
init: X,
f: F,
h: H
) where
B: 'static,
T: 'static,
X: Into<T>,
F: Fn(&mut T, &A) -> Option<RecvFuture<B>> + 'static,
H: Fn(&mut T, &Option<B>) + 'static,
Forwards messages on the given receiver to the given transmitter using a
stateful fold function that returns an optional future. The future, if
returned, is executed. The future results in an Option<B>
. In the case
that the value of the future's result is None
, no message will be sent to
the transmitter.
Lastly, a clean up function is ran at the completion of the future with its result.
To aid in returning a viable future in your fold function, use
wrap_future
.
pub fn merge<B: 'static>(rxs: Vec<Receiver<B>>) -> Receiver<B>
[src]
Merge all the receivers into one. Any time a message is received on any receiver, it will be sent to the returned receiver.
pub fn message(&self) -> impl Future<Output = A> where
A: Clone + 'static,
[src]
A: Clone + 'static,
Create a future to await the next message received by this Receiver
.
Trait Implementations
impl<A> Clone for Receiver<A>
[src]
pub fn clone(&self) -> Self
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl From<Receiver<String>> for ViewBuilder<Text>
[src]
impl<T> From<Receiver<T>> for Effect<T>
[src]
Auto Trait Implementations
impl<A> !RefUnwindSafe for Receiver<A>
impl<A> !Send for Receiver<A>
impl<A> !Sync for Receiver<A>
impl<A> Unpin for Receiver<A>
impl<A> !UnwindSafe for Receiver<A>
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,
pub 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.
pub fn to_owned(&self) -> T
[src]
pub 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.
pub 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>,