Struct futures_glib::Executor
[−]
[src]
pub struct Executor { /* fields omitted */ }
A handle through which futures can be executed.
This structure is an instance of a Source
which can be used to manage the
execution of a number of futures within.
Methods
impl Executor
[src]
pub fn new() -> Self
[src]
Creates a new executor unassociated with any context ready to start spawning futures.
pub fn attach(&self, cx: &MainContext)
[src]
Attaches this executor to a context, returning the token that it was assigned.
This is required to be called for futures to be completed.
pub fn remote(&self) -> Remote
[src]
Generates a remote handle to this event loop which can be used to spawn tasks from other threads into this event loop.
pub fn destroy(&self)
[src]
Unregister this executor and free up internal resources.
pub fn spawn<F: Future<Item = (), Error = ()> + 'static>(&self, future: F)
[src]
Spawns a new future onto the event loop that this source is associated with.
This function is given a future which is then spawned onto the glib event loop. The glib event loop will listen for incoming events of when futures are ready and attempt to push them all to completion.
The futures spawned here will not be completed unless the attach
function is called above.
pub fn spawn_fn<F, R>(&self, f: F) where
F: FnOnce() -> R + 'static,
R: IntoFuture<Item = (), Error = ()> + 'static,
[src]
F: FnOnce() -> R + 'static,
R: IntoFuture<Item = (), Error = ()> + 'static,
Same as spawn
above, but spawns a function that returns a future
Trait Implementations
impl Clone for Executor
[src]
fn clone(&self) -> Executor
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<F> FutureExecutor<F> for Executor where
F: Future<Item = (), Error = ()> + 'static,
[src]
F: Future<Item = (), Error = ()> + 'static,