Struct relm::Relm
[−]
[src]
pub struct Relm<MSG: Clone + DisplayVariant> { /* fields omitted */ }
Handle connection of futures to send messages to the update()
and update_command()
methods.
Methods
impl<MSG: Clone + DisplayVariant + Send + 'static> Relm<MSG>
[src]
fn connect<CALLBACK, FAILCALLBACK, STREAM, TOSTREAM>(
&self,
to_stream: TOSTREAM,
success_callback: CALLBACK,
failure_callback: FAILCALLBACK
) -> Box<Future<Item = (), Error = ()>> where
CALLBACK: Fn(STREAM::Item) -> MSG + 'static,
FAILCALLBACK: Fn(STREAM::Error) -> MSG + 'static,
STREAM: Stream + 'static,
TOSTREAM: ToStream<STREAM, Item = STREAM::Item, Error = STREAM::Error> + 'static,
&self,
to_stream: TOSTREAM,
success_callback: CALLBACK,
failure_callback: FAILCALLBACK
) -> Box<Future<Item = (), Error = ()>> where
CALLBACK: Fn(STREAM::Item) -> MSG + 'static,
FAILCALLBACK: Fn(STREAM::Error) -> MSG + 'static,
STREAM: Stream + 'static,
TOSTREAM: ToStream<STREAM, Item = STREAM::Item, Error = STREAM::Error> + '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.
Warning
This function must be executed of the tokio thread, i.e. in the
subscriptions()
or
update_command()
methods.
fn connect_ignore_err<CALLBACK, STREAM, TOSTREAM>(
&self,
to_stream: TOSTREAM,
success_callback: CALLBACK
) -> Box<Future<Item = (), Error = ()>> where
CALLBACK: Fn(STREAM::Item) -> MSG + 'static,
STREAM: Stream + 'static,
TOSTREAM: ToStream<STREAM, Item = STREAM::Item, Error = STREAM::Error> + 'static,
&self,
to_stream: TOSTREAM,
success_callback: CALLBACK
) -> Box<Future<Item = (), Error = ()>> where
CALLBACK: Fn(STREAM::Item) -> MSG + 'static,
STREAM: Stream + 'static,
TOSTREAM: ToStream<STREAM, Item = STREAM::Item, Error = STREAM::Error> + 'static,
This function is the same as Relm::connect()
except it does not take a
failure_callback
; hence, it ignores the errors.
Warning
This function must be executed of the tokio thread, i.e. in the
subscriptions()
or
update_command()
methods.
fn connect_exec<CALLBACK, FAILCALLBACK, STREAM, TOSTREAM>(
&self,
to_stream: TOSTREAM,
callback: CALLBACK,
failure_callback: FAILCALLBACK
) where
CALLBACK: Fn(STREAM::Item) -> MSG + 'static,
FAILCALLBACK: Fn(STREAM::Error) -> MSG + 'static,
STREAM: Stream + 'static,
TOSTREAM: ToStream<STREAM, Item = STREAM::Item, Error = STREAM::Error> + 'static,
&self,
to_stream: TOSTREAM,
callback: CALLBACK,
failure_callback: FAILCALLBACK
) where
CALLBACK: Fn(STREAM::Item) -> MSG + 'static,
FAILCALLBACK: Fn(STREAM::Error) -> MSG + 'static,
STREAM: Stream + 'static,
TOSTREAM: ToStream<STREAM, Item = STREAM::Item, Error = STREAM::Error> + 'static,
Connect the future to_stream
and spawn it on the tokio main loop.
Warning
This function must be executed of the tokio thread, i.e. in the
subscriptions()
or
update_command()
methods.
fn connect_exec_ignore_err<CALLBACK, STREAM, TOSTREAM>(
&self,
to_stream: TOSTREAM,
callback: CALLBACK
) where
CALLBACK: Fn(STREAM::Item) -> MSG + 'static,
STREAM: Stream + 'static,
TOSTREAM: ToStream<STREAM, Item = STREAM::Item, Error = STREAM::Error> + 'static,
&self,
to_stream: TOSTREAM,
callback: CALLBACK
) where
CALLBACK: Fn(STREAM::Item) -> MSG + 'static,
STREAM: Stream + 'static,
TOSTREAM: ToStream<STREAM, Item = STREAM::Item, Error = STREAM::Error> + 'static,
Connect the future to_stream
and spawn it on the tokio main loop, ignoring any error.
Warning
This function must be executed of the tokio thread, i.e. in the
subscriptions()
or
update_command()
methods.
fn exec<FUTURE: Future<Item = (), Error = ()> + 'static>(&self, future: FUTURE)
Spawn a future in the tokio event loop.
Warning
This function must be executed of the tokio thread, i.e. in the
subscriptions()
or
update_command()
methods.
fn handle(&self) -> &Handle
Get a handle to the tokio event loop.
fn stream(&self) -> &EventStream<MSG>
Get the event stream of the widget. This is used internally by the library.