Skip to main content

IoSource

Struct IoSource 

Source
pub struct IoSource { /* private fields */ }
Expand description

RAII I/O source registered with the thread-local reactor.

The token field is used as the unique identifier when submitting kevent / epoll_ctl calls. Tokens must be unique within a single reactor instance — this type uses an atomic counter to guarantee uniqueness without caller coordination.

Implementations§

Source§

impl IoSource

Source

pub fn new(raw: RawSource, token: usize, interest: Interest) -> Result<Self>

Register raw with the thread-local reactor under token, monitoring the given interest set.

§Errors

Propagates any OS error from the underlying register syscall.

Source

pub fn reregister(&self, interest: Interest) -> Result<()>

Update the interest mask for an already-registered source.

§Errors

Returns io::ErrorKind::NotConnected if the source was never registered (e.g. after a failed new), or propagates OS errors from reregister.

Source

pub fn raw(&self) -> RawSource

The raw OS handle.

Source

pub fn token(&self) -> usize

The token that identifies this source in reactor events.

Source

pub fn readable(&self) -> ReadableFuture<'_>

Returns a future that resolves once the source is readable.

On each poll the current waker is stored in the reactor’s waker registry. When the reactor fires a READABLE event for this token, the waker fires and the next poll returns Ready(Ok(())).

Source

pub fn writable(&self) -> WritableFuture<'_>

Returns a future that resolves once the source is writable.

Same waker integration as readable() but for WRITABLE events.

Trait Implementations§

Source§

impl Drop for IoSource

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

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.