Struct relm::Relm
[−]
[src]
pub struct Relm<UPDATE> where
UPDATE: Update, { /* fields omitted */ }
Handle connection of futures to send messages to the update()
method.
Methods
impl<UPDATE> Relm<UPDATE> where
UPDATE: Update,
[src]
UPDATE: Update,
fn new(
executor: Executor,
stream: EventStream<<UPDATE as Update>::Msg>
) -> Relm<UPDATE>
[src]
executor: Executor,
stream: EventStream<<UPDATE as Update>::Msg>
) -> Relm<UPDATE>
Create a new relm stream handler.
fn connect<CALLBACK, FAILCALLBACK, STREAM, TOSTREAM>(
&self,
to_stream: TOSTREAM,
success_callback: CALLBACK,
failure_callback: FAILCALLBACK
) -> Box<Future<Item = (), Error = ()> + 'static> where
CALLBACK: Fn(<STREAM as Stream>::Item) -> <UPDATE as Update>::Msg + 'static,
FAILCALLBACK: Fn(<STREAM as Stream>::Error) -> <UPDATE as Update>::Msg + 'static,
STREAM: Stream + 'static,
TOSTREAM: ToStream<STREAM, Item = <STREAM as Stream>::Item, Error = <STREAM as Stream>::Error> + 'static,
<UPDATE as Update>::Msg: 'static,
[src]
&self,
to_stream: TOSTREAM,
success_callback: CALLBACK,
failure_callback: FAILCALLBACK
) -> Box<Future<Item = (), Error = ()> + 'static> where
CALLBACK: Fn(<STREAM as Stream>::Item) -> <UPDATE as Update>::Msg + 'static,
FAILCALLBACK: Fn(<STREAM as Stream>::Error) -> <UPDATE as Update>::Msg + 'static,
STREAM: Stream + 'static,
TOSTREAM: ToStream<STREAM, Item = <STREAM as Stream>::Item, Error = <STREAM as Stream>::Error> + 'static,
<UPDATE as Update>::Msg: 'static,
Connect a Future
or a Stream
called to_stream
to send the message success_callback
in case of success and failure_callback
in case of failure.
Note
This function does not spawn the future.
You'll usually want to use Relm::connect_exec()
to both connect and spawn the future.
fn connect_ignore_err<CALLBACK, STREAM, TOSTREAM>(
&self,
to_stream: TOSTREAM,
success_callback: CALLBACK
) -> Box<Future<Item = (), Error = ()> + 'static> where
CALLBACK: Fn(<STREAM as Stream>::Item) -> <UPDATE as Update>::Msg + 'static,
STREAM: Stream + 'static,
TOSTREAM: ToStream<STREAM, Item = <STREAM as Stream>::Item, Error = <STREAM as Stream>::Error> + 'static,
<UPDATE as Update>::Msg: 'static,
[src]
&self,
to_stream: TOSTREAM,
success_callback: CALLBACK
) -> Box<Future<Item = (), Error = ()> + 'static> where
CALLBACK: Fn(<STREAM as Stream>::Item) -> <UPDATE as Update>::Msg + 'static,
STREAM: Stream + 'static,
TOSTREAM: ToStream<STREAM, Item = <STREAM as Stream>::Item, Error = <STREAM as Stream>::Error> + 'static,
<UPDATE as Update>::Msg: 'static,
This function is the same as Relm::connect()
except it does not take a
failure_callback
; hence, it ignores the errors.
fn connect_exec<CALLBACK, FAILCALLBACK, STREAM, TOSTREAM>(
&self,
to_stream: TOSTREAM,
callback: CALLBACK,
failure_callback: FAILCALLBACK
) where
CALLBACK: Fn(<STREAM as Stream>::Item) -> <UPDATE as Update>::Msg + 'static,
FAILCALLBACK: Fn(<STREAM as Stream>::Error) -> <UPDATE as Update>::Msg + 'static,
STREAM: Stream + 'static,
TOSTREAM: ToStream<STREAM, Item = <STREAM as Stream>::Item, Error = <STREAM as Stream>::Error> + 'static,
UPDATE: 'static,
<UPDATE as Update>::Msg: 'static,
[src]
&self,
to_stream: TOSTREAM,
callback: CALLBACK,
failure_callback: FAILCALLBACK
) where
CALLBACK: Fn(<STREAM as Stream>::Item) -> <UPDATE as Update>::Msg + 'static,
FAILCALLBACK: Fn(<STREAM as Stream>::Error) -> <UPDATE as Update>::Msg + 'static,
STREAM: Stream + 'static,
TOSTREAM: ToStream<STREAM, Item = <STREAM as Stream>::Item, Error = <STREAM as Stream>::Error> + 'static,
UPDATE: 'static,
<UPDATE as Update>::Msg: 'static,
Connect the future to_stream
and spawn it on the tokio main loop.
fn connect_exec_ignore_err<CALLBACK, STREAM, TOSTREAM>(
&self,
to_stream: TOSTREAM,
callback: CALLBACK
) where
CALLBACK: Fn(<STREAM as Stream>::Item) -> <UPDATE as Update>::Msg + 'static,
STREAM: Stream + 'static,
TOSTREAM: ToStream<STREAM, Item = <STREAM as Stream>::Item, Error = <STREAM as Stream>::Error> + 'static,
UPDATE: 'static,
<UPDATE as Update>::Msg: 'static,
[src]
&self,
to_stream: TOSTREAM,
callback: CALLBACK
) where
CALLBACK: Fn(<STREAM as Stream>::Item) -> <UPDATE as Update>::Msg + 'static,
STREAM: Stream + 'static,
TOSTREAM: ToStream<STREAM, Item = <STREAM as Stream>::Item, Error = <STREAM as Stream>::Error> + 'static,
UPDATE: 'static,
<UPDATE as Update>::Msg: 'static,
Connect the future to_stream
and spawn it on the tokio main loop, ignoring any error.
fn exec<FUTURE>(&self, future: FUTURE) where
FUTURE: 'static + Future<Item = (), Error = ()>,
[src]
FUTURE: 'static + Future<Item = (), Error = ()>,
Spawn a future in the tokio event loop.
fn executor(&self) -> &Executor
[src]
Get the handle of this stream.
fn stream(&self) -> &EventStream<<UPDATE as Update>::Msg>
[src]
Get the event stream of this stream. This is used internally by the library.
Trait Implementations
impl<UPDATE> Clone for Relm<UPDATE> where
UPDATE: Update,
[src]
UPDATE: Update,