pub struct Completion { /* private fields */ }Implementations§
Source§impl Completion
impl Completion
pub fn new(completion_type: CompletionType) -> Self
Sourcepub fn keep_write_buffer_alive(&self, buf: Arc<Buffer>)
pub fn keep_write_buffer_alive(&self, buf: Arc<Buffer>)
Stores a write buffer reference in the completion to keep it alive until the I/O completes. Required for async backends (io_uring, VFS) where pwrite returns before the kernel has consumed the buffer.
pub fn new_write<F>(complete: F) -> Self
pub fn new_read<F>(buf: Arc<Buffer>, complete: F) -> Selfwhere
F: Fn(Result<(Arc<Buffer>, i32), CompletionError>) -> Option<CompletionError> + Send + Sync + 'static,
pub fn new_sync<F>(complete: F) -> Self
pub fn new_trunc<F>(complete: F) -> Self
Sourcepub fn new_yield() -> Self
pub fn new_yield() -> Self
Create a yield completion. These are completed by default allowing to yield control without allocating memory.
pub fn wake(&self)
Sourcepub fn wake_progress(&self)
pub fn wake_progress(&self)
Fire a “progress wake” without consuming the completion’s result —
wakes the waker on this completion and on its parent group, if any.
Used by IO backends to nudge the future when an operation made progress
but isn’t fully done (e.g. an io_uring writev that completed only the
first chunk and was resubmitted internally). Without this, a poll
whose drained CQEs are all intermediate-chunk completions returns
without waking anything, and since step() is the only thing that
drains the CQ, the resubmitted chunks pile up and the task deadlocks.
pub fn set_waker(&self, waker: &Waker)
pub fn succeeded(&self) -> bool
pub fn failed(&self) -> bool
pub fn get_error(&self) -> Option<CompletionError>
Sourcepub fn is_explicit_yield(&self) -> bool
pub fn is_explicit_yield(&self) -> bool
Returns true if this completion is an explicit yield — a signal to return control to the cooperative scheduler so other connections can make progress. Unlike real I/O completions that happen to be finished, yield completions must not be treated as “ready to continue immediately” because the yielding operation is waiting on external state (e.g. a lock held by another fiber) that can only change when other fibers are stepped.
pub fn complete(&self, result: i32)
pub fn error(&self, err: CompletionError)
pub fn abort(&self)
Sourcepub fn as_read(&self) -> &ReadCompletion
pub fn as_read(&self) -> &ReadCompletion
only call this method if you are sure that the completion is a ReadCompletion, panics otherwise
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Completion
impl !UnwindSafe for Completion
impl Freeze for Completion
impl Send for Completion
impl Sync for Completion
impl Unpin for Completion
impl UnsafeUnpin for Completion
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more