Struct tokio::runtime::io::driver::Handle

source ·
pub(crate) struct Handle {
    registry: Registry,
    registrations: RegistrationSet,
    synced: Mutex<Synced>,
    waker: Waker,
    pub(crate) metrics: IoDriverMetrics,
}
Expand description

A reference to an I/O driver.

Fields§

§registry: Registry

Registers I/O resources.

§registrations: RegistrationSet

Tracks all registrations

§synced: Mutex<Synced>

State that should be synchronized

§waker: Waker

Used to wake up the reactor from a call to turn. Not supported on Wasi due to lack of threading support.

§metrics: IoDriverMetrics

Implementations§

source§

impl Handle

source

pub(crate) fn unpark(&self)

Forces a reactor blocked in a call to turn to wakeup, or otherwise makes the next call to turn return immediately.

This method is intended to be used in situations where a notification needs to otherwise be sent to the main reactor. If the reactor is currently blocked inside of turn then it will wake up and soon return after this method has been called. If the reactor is not currently blocked in turn, then the next call to turn will not block and return immediately.

source

pub(super) fn add_source( &self, source: &mut impl Source, interest: Interest, ) -> Result<Arc<ScheduledIo>>

Registers an I/O resource with the reactor for a given mio::Ready state.

The registration token is returned.

source

pub(super) fn deregister_source( &self, registration: &Arc<ScheduledIo>, source: &mut impl Source, ) -> Result<()>

Deregisters an I/O resource from the reactor.

source

fn release_pending_registrations(&self)

Trait Implementations§

source§

impl Debug for Handle

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl !Freeze for Handle

§

impl RefUnwindSafe for Handle

§

impl Send for Handle

§

impl Sync for Handle

§

impl Unpin for Handle

§

impl UnwindSafe for Handle

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>,

§

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>,

§

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.