pub struct IoDriver<T> { /* private fields */ }Expand description
A driver to spawn tasks and IO objects on IoPool.
Implementations§
Source§impl<T> IoDriver<T>
impl<T> IoDriver<T>
Sourcepub fn downgrade(&self) -> WeakIoDriver<T>
pub fn downgrade(&self) -> WeakIoDriver<T>
Returns a weak reference to this driver.
A WeakIoDriver does not keep the backing IoPool alive: IoPool::run
returns once the last strong IoDriver is dropped. Use this to publish a
reference to a pool’s own driver (e.g. into thread-local storage on the
pool’s thread) without preventing the pool from ever shutting down. A
strong self-reference held for the lifetime of run would instead keep the
pool’s task queue open forever (the pool never sees its last driver drop),
leaking the thread and its IO backend.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for IoDriver<T>
impl<T> !RefUnwindSafe for IoDriver<T>
impl<T> Send for IoDriver<T>
impl<T> Sync for IoDriver<T>
impl<T> Unpin for IoDriver<T>
impl<T> UnsafeUnpin for IoDriver<T>
impl<T> !UnwindSafe for IoDriver<T>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Driver for Twhere
T: 'static + Send + Sync + FdReadyDriver + TimerDriver + SocketReadyDriver + WaitDriver + IoUringDriver,
impl<T> Driver for Twhere
T: 'static + Send + Sync + FdReadyDriver + TimerDriver + SocketReadyDriver + WaitDriver + IoUringDriver,
Source§fn new_dyn_timer(&self) -> SmallBox<dyn PollTimer, S4> ⓘ
fn new_dyn_timer(&self) -> SmallBox<dyn PollTimer, S4> ⓘ
Returns a new timer.
Source§fn new_dyn_fd_ready(
&self,
fd: i32,
) -> Result<SmallBox<dyn PollFdReady, S4>, Error>
fn new_dyn_fd_ready( &self, fd: i32, ) -> Result<SmallBox<dyn PollFdReady, S4>, Error>
Returns a new object for polling file descriptor readiness.
Source§fn new_dyn_socket_ready(
&self,
socket: i32,
) -> Result<SmallBox<dyn PollSocketReady, S4>, Error>
fn new_dyn_socket_ready( &self, socket: i32, ) -> Result<SmallBox<dyn PollSocketReady, S4>, Error>
Creates a new object for polling socket readiness.
Source§fn new_dyn_wait(
&self,
fd: i32,
read_size: usize,
) -> Result<SmallBox<dyn PollWait, S4>, Error>
fn new_dyn_wait( &self, fd: i32, read_size: usize, ) -> Result<SmallBox<dyn PollWait, S4>, Error>
Creates a new wait. Read more
Source§fn io_uring_probe(&self, opcode: u8) -> bool
fn io_uring_probe(&self, opcode: u8) -> bool
Returns whether the given opcode is supported by the ring.
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> SocketReadyDriver for Twhere
T: FdReadyDriver,
impl<T> SocketReadyDriver for Twhere
T: FdReadyDriver,
Source§type SocketReady = <T as FdReadyDriver>::FdReady
type SocketReady = <T as FdReadyDriver>::FdReady
The socket ready type.
Source§fn new_socket_ready(
&self,
socket: i32,
) -> Result<<T as SocketReadyDriver>::SocketReady, Error>
fn new_socket_ready( &self, socket: i32, ) -> Result<<T as SocketReadyDriver>::SocketReady, Error>
Creates a new object for polling socket readiness.