Skip to main content

Completion

Struct Completion 

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

A completion packet dequeued from a CompletionPort.

Dequeuing removes the operation from the port’s outstanding set, so holding a completion never blocks CompletionPort::run_down or the port’s Drop. The completion still owns the operation’s storage until it is dropped or claimed, and may outlive the port it came from.

Implementations§

Source§

impl Completion

Source

pub fn key(&self) -> usize

The completion key the packet was tagged with.

Source

pub fn bytes_transferred(&self) -> u32

The number of bytes transferred by the operation.

Source

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

The OVERLAPPED pointer identifying the completed operation.

For a user packet this is whatever value was passed to CompletionPort::post.

Source

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

The identity of the operation this packet completes.

It matches the OperationId that AssociatedEndpoint::submit returned for the operation, so a caller holding submission-time identities can match a completion against them directly. Returns None for a user packet from CompletionPort::post, which completes no operation.

Source

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

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

Source

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

Recover the owned operation whose completion this is.

§Safety

This completion must have been produced by submitting an Operation<P> of this exact type through AssociatedEndpoint::submit, and it must be claimed exactly once.

Trait Implementations§

Source§

impl Debug for Completion

Source§

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

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

impl Drop for Completion

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 = !

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.