[][src]Struct fibers::fiber::Scheduler

pub struct Scheduler { /* fields omitted */ }

Scheduler of spawned fibers.

Scheduler manages spawned fibers state. If a fiber is in runnable state (e.g., not waiting for I/O events), the scheduler will push the fiber in it's run queue. When run_once method is called, the first fiber (i.e., future) in the queue will be poped and executed (i.e., Future::poll method is called). If the future of a fiber moves to readied state, it will be removed from the scheduler. For efficiency reasons, it is recommended to run a scheduler on a dedicated thread.

Methods

impl Scheduler[src]

pub fn new(poller: PollerHandle) -> Self[src]

Creates a new scheduler instance.

pub fn scheduler_id(&self) -> SchedulerId[src]

Returns the identifier of this scheduler.

pub fn run_queue_len(&self) -> usize[src]

Returns the length of the run queue of this scheduler.

pub fn fiber_count(&self) -> usize[src]

Returns the count of alive fibers (i.e., not readied futures) in this scheduler.

pub fn handle(&self) -> SchedulerHandle[src]

Returns a handle of this scheduler.

pub fn run_once(&mut self, block_if_idle: bool)[src]

Runs one unit of works.

Trait Implementations

impl Debug for Scheduler[src]

Auto Trait Implementations

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]