Skip to main content

IoDriver

Struct IoDriver 

Source
pub struct IoDriver<T> { /* private fields */ }
Expand description

A driver to spawn tasks and IO objects on IoPool.

Implementations§

Source§

impl<T> IoDriver<T>

Source

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§

Source§

impl<T> Clone for IoDriver<T>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug> Debug for IoDriver<T>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<T: IoBackend> Spawn for IoDriver<T>

Source§

fn scheduler(&self, _metadata: &TaskMetadata) -> Arc<dyn Schedule>

Gets a scheduler for a new task.
Source§

fn spawn<T: 'static + Send>( &self, name: impl Into<Arc<str>>, fut: impl Future<Output = T> + Send + 'static, ) -> Task<T>
where Self: Sized,

Spawns a task.

Auto Trait Implementations§

§

impl<T> Freeze for IoDriver<T>

§

impl<T> !RefUnwindSafe for IoDriver<T>

§

impl<T> Send for IoDriver<T>
where T: Sync + Send,

§

impl<T> Sync for IoDriver<T>
where T: Sync + Send,

§

impl<T> Unpin for IoDriver<T>

§

impl<T> UnsafeUnpin for IoDriver<T>

§

impl<T> !UnwindSafe for IoDriver<T>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Driver for T

Source§

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>

Returns a new object for polling file descriptor readiness.
Source§

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>

Creates a new wait. Read more
Source§

fn io_uring_probe(&self, opcode: u8) -> bool

Returns whether the given opcode is supported by the ring.
Source§

unsafe fn io_uring_submit( &self, sqe: Entry, ) -> Pin<Box<dyn Future<Output = Result<i32, Error>> + Send + '_>>

Submits an io-uring SQE for asynchronous execution. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> SocketReadyDriver for T
where T: FdReadyDriver,

Source§

type SocketReady = <T as FdReadyDriver>::FdReady

The socket ready type.
Source§

fn new_socket_ready( &self, socket: i32, ) -> Result<<T as SocketReadyDriver>::SocketReady, Error>

Creates a new object for polling socket readiness.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
Source§

impl<T> SpawnDriver for T
where T: Spawn + Driver,