Config

Struct Config 

Source
pub(crate) struct Config {
    pub(crate) global_queue_interval: Option<u32>,
    pub(crate) event_interval: u32,
    pub(crate) before_park: Option<Arc<dyn Fn() + Send + Sync>>,
    pub(crate) after_unpark: Option<Arc<dyn Fn() + Send + Sync>>,
    pub(crate) before_spawn: Option<Arc<dyn Fn(&TaskMeta<'_>) + Send + Sync>>,
    pub(crate) after_termination: Option<Arc<dyn Fn(&TaskMeta<'_>) + Send + Sync>>,
    pub(crate) disable_lifo_slot: bool,
    pub(crate) seed_generator: RngSeedGenerator,
    pub(crate) metrics_poll_count_histogram: Option<HistogramBuilder>,
    pub(crate) enable_eager_driver_handoff: bool,
}

Fields§

§global_queue_interval: Option<u32>

How many ticks before pulling a task from the global/remote queue?

§event_interval: u32

How many ticks before yielding to the driver for timer and I/O events?

§before_park: Option<Arc<dyn Fn() + Send + Sync>>

Callback for a worker parking itself

§after_unpark: Option<Arc<dyn Fn() + Send + Sync>>

Callback for a worker unparking itself

§before_spawn: Option<Arc<dyn Fn(&TaskMeta<'_>) + Send + Sync>>

To run before each task is spawned.

§after_termination: Option<Arc<dyn Fn(&TaskMeta<'_>) + Send + Sync>>

To run after each task is terminated.

§disable_lifo_slot: bool

The multi-threaded scheduler includes a per-worker LIFO slot used to store the last scheduled task. This can improve certain usage patterns, especially message passing between tasks.

In Tokio versions before 1.51, tasks in the LIFO slot could not be stolen, which could cause issues in applications with long poll times. As a stop-gap, this unstable option lets users disable the LIFO task. Now that the LIFO slot is stealable, we may remove this option in a future version.

§seed_generator: RngSeedGenerator

Random number generator seed to configure runtimes to act in a deterministic way.

§metrics_poll_count_histogram: Option<HistogramBuilder>

How to build poll time histograms

§enable_eager_driver_handoff: bool

If true, an idle worker is woken whenever a worker thread transitions from polling the I/O driver to polling its own tasks (requires tokio_unstable).

Auto Trait Implementations§

§

impl !Freeze for Config

§

impl !RefUnwindSafe for Config

§

impl Send for Config

§

impl Sync for Config

§

impl Unpin for Config

§

impl !UnwindSafe for Config

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.