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.
Implementations§
Source§impl<T, P> Started<T, P>
impl<T, P> Started<T, P>
Sourcepub fn is_pending(&self) -> bool
pub fn is_pending(&self) -> bool
Whether a completion will arrive for this operation.
Sourcepub fn is_completed(&self) -> bool
pub fn is_completed(&self) -> bool
Whether the operation already finished with no completion to come.
Sourcepub fn completed(self) -> Option<(P, usize)>
pub fn completed(self) -> Option<(P, usize)>
The payload and byte count, if the operation already finished.
Sourcepub fn expect_pending(self, message: &str) -> T
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.