[−][src]Struct fibers::fiber::Scheduler
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
Auto Trait Implementations
impl Send for Scheduler
impl !Sync for Scheduler
impl Unpin for Scheduler
impl !UnwindSafe for Scheduler
impl !RefUnwindSafe for Scheduler
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,