pub struct IoRingError { /* private fields */ }Expand description
An error from an IoRing API call.
Every IoRing entry point reports failure as an HRESULT, not through
GetLastError the way most of Win32 does, so this crate cannot reuse
io::Error::last_os_error the way windows-overlapped-io-sys does.
§Matching on one of these
A kernel-reported failure always reaches a caller as an io::Error whose
kind is io::ErrorKind::Other, because there is no
faithful ErrorKind for most IORING_E_* conditions (M10.2, D-30). The
HRESULT is not lost – it is this value, behind a downcast – but
kind() will not find it. kind() discriminates only this crate’s own
rejections, which use Unsupported, InvalidInput, and AlreadyExists.
So a consumer branching on a ring condition – most often
IORING_E_SUBMISSION_QUEUE_FULL, the backpressure signal every push’s
docs name – asks through IoRingErrorExt (M10.5), which is the
downcast plus the comparison named once rather than hand-rolled:
use windows_ioring_sys::IoRingErrorExt;
fn classify(error: &std::io::Error) -> &'static str {
if error.is_submission_queue_full() {
"backpressure: submit, drain, retry"
} else if let Some(condition) = error.ring_condition() {
condition.name()
} else {
"not a ring condition"
}
}Implementations§
Source§impl IoRingError
impl IoRingError
Sourcepub fn name(&self) -> Option<&'static str>
pub fn name(&self) -> Option<&'static str>
The named IORING_E_* constant this value matches, if any.
Derived from IoRingError::condition rather than matching the
HRESULT a second time, so the two can never disagree about which
codes are named (M10.5).
Sourcepub fn condition(&self) -> Option<RingCondition>
pub fn condition(&self) -> Option<RingCondition>
The named condition this error reports, or None for an HRESULT
this crate does not name (M10.5).
match on this when a consumer needs to distinguish several
conditions; use a predicate like
IoRingError::is_submission_queue_full for a single branch.
Sourcepub fn is_submission_queue_full(&self) -> bool
pub fn is_submission_queue_full(&self) -> bool
Whether this is IORING_E_SUBMISSION_QUEUE_FULL: the backpressure
signal every push’s documentation names (M3.3).
Recoverable, and the one condition a normal submission loop is expected to branch on: submit what is already queued, drain completions, and retry the push.
Sourcepub fn is_completion_queue_too_full(&self) -> bool
pub fn is_completion_queue_too_full(&self) -> bool
Whether this is IORING_E_COMPLETION_QUEUE_TOO_FULL: the completion
queue has no room for further results, so completions must be drained
with crate::IoRing::try_pop.
Sourcepub fn is_submit_in_progress(&self) -> bool
pub fn is_submit_in_progress(&self) -> bool
Whether this is IORING_E_SUBMIT_IN_PROGRESS: another submit is
already running on this ring.
Trait Implementations§
Source§impl Clone for IoRingError
impl Clone for IoRingError
impl Copy for IoRingError
Source§impl Debug for IoRingError
impl Debug for IoRingError
Source§impl Display for IoRingError
impl Display for IoRingError
impl Eq for IoRingError
Source§impl Error for IoRingError
impl Error for IoRingError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()