Skip to main content

Started

Enum Started 

Source
pub enum Started<T, P> {
    Pending(T),
    Completed {
        payload: P,
        bytes_transferred: usize,
    },
}
Expand description

What became of an adapter submission that did not fail immediately.

This is crate::Submitted as an adapter reports it: the Failed arm is folded into the enclosing io::Result’s Err, and the operation storage of a synchronous completion is already reduced to the payload the matching token’s claim would have yielded, so the two arms report the same shape.

Variants§

§

Pending(T)

The operation is in flight and a completion will arrive for it. Claim its result with the token, which also carries the operation’s identity for cancellation and matching.

§

Completed

The operation finished synchronously and no completion will arrive, so there is nothing to claim and its payload is returned directly.

Only reachable on an endpoint in FILE_SKIP_COMPLETION_PORT_ON_SUCCESS mode; an endpoint left in the default mode always reports Started::Pending, because the I/O Manager queues a packet even for an immediate success.

Fields

§payload: P

The buffers the operation owned – the same payload the token’s claim yields on the pending path.

§bytes_transferred: usize

The byte count the native call reported.

Implementations§

Source§

impl<T, P> Started<T, P>

Source

pub fn is_pending(&self) -> bool

Whether a completion will arrive for this operation.

Source

pub fn is_completed(&self) -> bool

Whether the operation already finished with no completion to come.

Source

pub fn pending(self) -> Option<T>

The token, if a completion will arrive.

Source

pub fn completed(self) -> Option<(P, usize)>

The payload and byte count, if the operation already finished.

Source

pub fn expect_pending(self, message: &str) -> T

The token, panicking if the operation completed synchronously.

For a caller that never puts its endpoints in FILE_SKIP_COMPLETION_PORT_ON_SUCCESS mode, where the synchronous arm is unreachable and matching on it is noise.

§Panics

Panics with message if the operation completed synchronously, which means the endpoint was in skip-on-success mode after all.

Trait Implementations§

Source§

impl<T: Debug, P: Debug> Debug for Started<T, P>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<T, P> Freeze for Started<T, P>
where T: Freeze, P: Freeze,

§

impl<T, P> RefUnwindSafe for Started<T, P>

§

impl<T, P> Send for Started<T, P>
where T: Send, P: Send,

§

impl<T, P> Sync for Started<T, P>
where T: Sync, P: Sync,

§

impl<T, P> Unpin for Started<T, P>
where T: Unpin, P: Unpin,

§

impl<T, P> UnsafeUnpin for Started<T, P>
where T: UnsafeUnpin, P: UnsafeUnpin,

§

impl<T, P> UnwindSafe for Started<T, P>
where T: UnwindSafe, P: UnwindSafe,

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.