Skip to main content

IoCompletion

Struct IoCompletion 

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

One operation completion delivered to a ThreadpoolIo callback.

The completion borrows the operation’s storage for the duration of the callback. Recover the owned operation with IoCompletion::claim when the payload type is known; otherwise the storage is reclaimed generically when the callback returns, which is what lets one object carry operations of mixed payload types.

Implementations§

Source§

impl IoCompletion

Source

pub fn bytes_transferred(&self) -> usize

The number of bytes transferred by the operation.

Source

pub fn io_result(&self) -> u32

The raw Win32 result the pool reported, NO_ERROR on success.

Source

pub fn error(&self) -> Option<Error>

The failure of the completed operation, if it did not succeed.

A cancelled operation completes here as ERROR_OPERATION_ABORTED.

Source

pub fn id(&self) -> Option<OperationId>

The identity of the completed operation, as returned by ThreadpoolIo::submit.

It compares equal to the OperationId that submission returned, so a caller holding submission-time identities can match a completion against them directly.

Source

pub fn overlapped_ptr(&self) -> *mut OVERLAPPED

The OVERLAPPED pointer identifying the completed operation.

Source

pub unsafe fn claim<P>(&self) -> Operation<P>

Recover the owned operation whose completion this is.

The operation is returned in OperationState::Completed whether or not it succeeded, matching the raw IOCP backend; read IoCompletion::error for the outcome.

§Safety

This completion must be for an Operation<P> of this exact type submitted through ThreadpoolIo::submit, and it must be claimed at most once.

Trait Implementations§

Source§

impl Debug for IoCompletion

Source§

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

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

impl Drop for IoCompletion

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. 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.