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>
impl<S> MioInstaller<S>
Sourcepub fn new() -> Self
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)
Sourcepub fn event_capacity(self, cap: usize) -> Self
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.
Sourcepub fn handler_capacity(self, cap: usize) -> Self
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>
impl<S> Default for MioInstaller<S>
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more