Skip to main content

Proactor

Struct Proactor 

Source
pub struct Proactor { /* private fields */ }
Expand description

The process’s proactor: its configuration, and the IO of the calling thread’s shard.

Implementations§

Source§

impl Proactor

Source

pub fn get() -> &'static Proactor

The proactor, with the default configuration unless with_config set one first.

Source

pub fn with_config(config: NucleiConfig) -> &'static Proactor

Sets the proactor’s configuration, and returns the proactor. It is the default every runtime starts from; Builder::io_uring gives one runtime ring settings of its own, checked when it is built.

§Panics

When the proactor was configured already, or used (which configures it with the defaults): a configuration is set once, before any IO. The signature returns the proactor itself, so it has no error to answer; Builder::io_uring answers its error instead.

Source

pub fn config(&self) -> &NucleiConfig

The configuration in place.

Source

pub fn wake(&self)

Ends every wait in progress at once.

Source

pub fn wait( &self, max_event_size: usize, duration: Option<Duration>, ) -> Result<usize>

Drives the calling thread’s shard once: runs its ready tasks, waits for IO (up to duration; None until some comes or wake), handling at most max_event_size events, and runs the tasks the IO woke. Returns how many IO events it handled.

§Errors

When the thread’s shard cannot start, or its poller fails.

Source

pub fn backend() -> IoBackend

The backend the calling thread’s shard runs its IO on; on a thread that runs none, the one of every runtime that names none (the platform’s poller when the backend named cannot be had: the shards then fail with the reason).

Trait Implementations§

Source§

impl Debug for Proactor

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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.

§

impl<T> MaybeSend for T
where T: Send + ?Sized,

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.