[go: up one dir, main page]

[][src]Trait pasts::Executor

pub trait Executor: 'static + Send + Sync + Sized {
    unsafe fn trigger_event(&self);
unsafe fn wait_for_event(&self);
fn is_used(&self) -> bool; fn block_on<F: Future>(&'static self, f: F) -> <F as Future>::Output { ... } }

An executor for Futures.

Required methods

unsafe fn trigger_event(&self)

Cause wait_for_event() to return.

Safety

This method is marked unsafe because it must only be called from a Waker. This is guaranteed by the block_on() method.

unsafe fn wait_for_event(&self)

Blocking wait until an event is triggered with trigger_event. This function should put the current thread or processor to sleep to save power consumption.

Safety

This function should only be called by one executor. On the first call to this method, all following calls to is_used() should return true. This method is marked unsafe because only one thread and one executor can call it (ever!). This is guaranteed by the block_on() method.

fn is_used(&self) -> bool

Should return true if wait_for_event has been called, false otherwise.

Loading content...

Provided methods

fn block_on<F: Future>(&'static self, f: F) -> <F as Future>::Output

Run a future to completion on the current thread. This will cause the current thread to block.

Loading content...

Implementors

impl Executor for CvarExec[src]

Loading content...