Skip to main content

MioInstaller

Struct MioInstaller 

Source
pub struct MioInstaller<S = Box<dyn Handler<Event>>> { /* private fields */ }
Expand description

Mio driver installer — generic over handler storage.

S is the handler storage type. Defaults to Box<dyn Handler<mio::event::Event>>.

Consumed by WorldBuilder::install_driver. Registers a MioDriver<S> resource and returns a MioPoller for poll-time use.

§Examples

// Defaults: 1024 events, 64 handlers
let poller = builder.install_driver(MioInstaller::new());

// Custom capacities
let poller = builder.install_driver(
    MioInstaller::new()
        .event_capacity(256)
        .handler_capacity(32),
);

Implementations§

Source§

impl<S> MioInstaller<S>

Source

pub fn new() -> Self

Creates a new mio installer with default capacities.

Defaults:

  • event_capacity: 1024 (mio events buffer)
  • handler_capacity: 64 (slab pre-allocation)
Source

pub fn event_capacity(self, cap: usize) -> Self

Set the mio events buffer capacity (default: 1024).

This is the maximum number of readiness events returned per poll() call. Events beyond this limit are deferred to the next poll.

Source

pub fn handler_capacity(self, cap: usize) -> Self

Set the initial handler slab pre-allocation (default: 64).

The slab grows automatically if more handlers are inserted. Pre-allocating avoids reallocation during early setup.

Trait Implementations§

Source§

impl<S> Default for MioInstaller<S>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<S: Send + 'static> Installer for MioInstaller<S>

Source§

type Poller = MioPoller<S>

The concrete poller returned after installation.
Source§

fn install(self, world: &mut WorldBuilder) -> MioPoller<S>

Register resources into the world and return a poller for dispatch.

Auto Trait Implementations§

§

impl<S> Freeze for MioInstaller<S>

§

impl<S> RefUnwindSafe for MioInstaller<S>
where S: RefUnwindSafe,

§

impl<S> Send for MioInstaller<S>
where S: Send,

§

impl<S> Sync for MioInstaller<S>
where S: Sync,

§

impl<S> Unpin for MioInstaller<S>
where S: Unpin,

§

impl<S> UnsafeUnpin for MioInstaller<S>

§

impl<S> UnwindSafe for MioInstaller<S>
where S: UnwindSafe,

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.