[−][src]Struct mogwai::txrx::Transmitter
Send messages instantly.
Implementations
impl<A: 'static> Transmitter<A>
[src]
pub fn new() -> Transmitter<A>
[src]
Create a new transmitter.
pub fn spawn_recv(&mut self) -> Receiver<A>
[src]
Spawn a receiver for this transmitter.
pub fn send(&self, a: &A)
[src]
Send a message to any and all receivers of this transmitter.
pub fn send_async<FutureA>(&self, fa: FutureA) where
FutureA: Future<Output = A> + 'static,
[src]
FutureA: Future<Output = A> + 'static,
Execute a future that results in a message, then send it.
pub fn contra_filter_fold_shared<B, T, F>(
&self,
var: Rc<RefCell<T>>,
f: F
) -> Transmitter<B> where
B: 'static,
T: 'static,
F: Fn(&mut T, &B) -> Option<A> + 'static,
[src]
&self,
var: Rc<RefCell<T>>,
f: F
) -> Transmitter<B> where
B: 'static,
T: 'static,
F: Fn(&mut T, &B) -> Option<A> + 'static,
Extend this transmitter with a new transmitter using a filtering fold
function. The given function folds messages of B
over a shared state T
and optionally sends A
s down into this transmitter.
pub fn contra_filter_fold<B, X, T, F>(&self, init: X, f: F) -> Transmitter<B> where
B: 'static,
T: 'static,
X: Into<T>,
F: Fn(&mut T, &B) -> Option<A> + 'static,
[src]
B: 'static,
T: 'static,
X: Into<T>,
F: Fn(&mut T, &B) -> Option<A> + 'static,
Extend this transmitter with a new transmitter using a filtering fold
function. The given function folds messages of B
over a state T
and
optionally sends A
s into this transmitter.
pub fn contra_fold<B, X, T, F>(&self, init: X, f: F) -> Transmitter<B> where
B: 'static,
T: 'static,
X: Into<T>,
F: Fn(&mut T, &B) -> A + 'static,
[src]
B: 'static,
T: 'static,
X: Into<T>,
F: Fn(&mut T, &B) -> A + 'static,
Extend this transmitter with a new transmitter using a fold function.
The given function folds messages of B
into a state T
and sends A
s
into this transmitter.
pub fn contra_filter_map<B, F>(&self, f: F) -> Transmitter<B> where
B: 'static,
F: Fn(&B) -> Option<A> + 'static,
[src]
B: 'static,
F: Fn(&B) -> Option<A> + 'static,
Extend this transmitter with a new transmitter using a filter function.
The given function maps messages of B
and optionally sends A
s into this
transmitter.
pub fn contra_map<B, F>(&self, f: F) -> Transmitter<B> where
B: 'static,
F: Fn(&B) -> A + 'static,
[src]
B: 'static,
F: Fn(&B) -> A + 'static,
Extend this transmitter with a new transmitter using a map function.
The given function maps messages of B
into A
s and sends them all into
this transmitter. This is much like Haskell's
contramap,
hence the contra_
prefix on this family of methods.
pub fn wire_filter_fold_shared<T, B, F>(
&mut self,
rb: &Receiver<B>,
var: Rc<RefCell<T>>,
f: F
) where
B: 'static,
T: 'static,
F: Fn(&mut T, &A) -> Option<B> + 'static,
[src]
&mut self,
rb: &Receiver<B>,
var: Rc<RefCell<T>>,
f: F
) where
B: 'static,
T: 'static,
F: Fn(&mut T, &A) -> Option<B> + 'static,
Wires the transmitter to send to the given receiver 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 receiver.
pub fn wire_filter_fold<T, B, X, F>(&mut self, rb: &Receiver<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,
Wires the transmitter to send to the given receiver 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 receiver.
pub fn wire_fold<T, B, X, F>(&mut self, rb: &Receiver<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,
Wires the transmitter to send to the given receiver using a stateful fold function.
pub fn wire_fold_shared<T, B, F>(
&mut self,
rb: &Receiver<B>,
var: Rc<RefCell<T>>,
f: F
) where
B: 'static,
T: 'static,
F: Fn(&mut T, &A) -> B + 'static,
[src]
&mut self,
rb: &Receiver<B>,
var: Rc<RefCell<T>>,
f: F
) where
B: 'static,
T: 'static,
F: Fn(&mut T, &A) -> B + 'static,
Wires the transmitter to send to the given receiver using a stateful fold function, where the state is a shared mutex.
pub fn wire_filter_map<B, F>(&mut self, rb: &Receiver<B>, f: F) where
B: 'static,
F: Fn(&A) -> Option<B> + 'static,
[src]
B: 'static,
F: Fn(&A) -> Option<B> + 'static,
Wires the transmitter to the given receiver 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 wire_map<B, F>(&mut self, rb: &Receiver<B>, f: F) where
B: 'static,
F: Fn(&A) -> B + 'static,
[src]
B: 'static,
F: Fn(&A) -> B + 'static,
Wires the transmitter to the given receiver using a stateless map function.
pub fn wire_filter_fold_async<T, B, X, F, H>(
&mut self,
rb: &Receiver<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]
&mut self,
rb: &Receiver<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,
Wires the transmitter to the given receiver using a stateful fold function
that returns an optional future. The future, if available, 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 given receiver.
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
.
Trait Implementations
impl<A> Clone for Transmitter<A>
[src]
fn clone(&self) -> Self
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Auto Trait Implementations
impl<A> !RefUnwindSafe for Transmitter<A>
impl<A> !Send for Transmitter<A>
impl<A> !Sync for Transmitter<A>
impl<A> Unpin for Transmitter<A>
impl<A> !UnwindSafe for Transmitter<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,
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>,