Struct tokio::runtime::current_thread::Handle [−][src]
pub struct Handle(_);
Handle to spawn a future on the corresponding CurrentThread
runtime instance
Methods
impl Handle
[src]
impl Handle
pub fn spawn<F>(&self, future: F) -> Result<(), SpawnError> where
F: Future<Item = (), Error = ()> + Send + 'static,
[src]
pub fn spawn<F>(&self, future: F) -> Result<(), SpawnError> where
F: Future<Item = (), Error = ()> + Send + 'static,
Spawn a future onto the CurrentThread
runtime instance corresponding to this handle
Panics
This function panics if the spawn fails. Failure occurs if the CurrentThread
instance of the Handle
does not exist anymore.
pub fn status(&self) -> Result<(), SpawnError>
[src]
pub fn status(&self) -> Result<(), SpawnError>
Provides a best effort hint to whether or not spawn
will succeed.
This function may return both false positives and false negatives.
If status
returns Ok
, then a call to spawn
will probably
succeed, but may fail. If status
returns Err
, a call to spawn
will
probably fail, but may succeed.
This allows a caller to avoid creating the task if the call to spawn
has a high likelihood of failing.
Trait Implementations
impl Debug for Handle
[src]
impl Debug for Handle
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Clone for Handle
[src]
impl Clone for Handle
fn clone(&self) -> Handle
[src]
fn clone(&self) -> Handle
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl<T> Executor<T> for Handle where
T: Future<Item = (), Error = ()> + Send + 'static,
[src]
impl<T> Executor<T> for Handle where
T: Future<Item = (), Error = ()> + Send + 'static,