pub enum SaferRingError {
BufferInFlight,
OperationPending,
OperationsInFlight {
count: usize,
},
InvalidStateTransition,
NotRegistered,
PoolEmpty,
PoolPoisoned,
Io(Error),
}Expand description
Comprehensive error type for safer-ring operations.
This enum covers all possible error conditions that can occur during safer-ring operations, from memory safety violations to underlying system errors. Each variant provides specific context about the failure.
§Design Notes
- Uses
thiserrorfor automaticErrortrait implementation - Provides automatic conversion from common error types via
#[from] - Platform-specific variants are conditionally compiled
- All variants are
Send + Syncfor use in async contexts
Variants§
BufferInFlight
Buffer is still in flight and cannot be accessed.
This error occurs when attempting to access or drop a buffer that is currently being used by an in-flight io_uring operation. The buffer must remain pinned until the operation completes.
OperationPending
Operation is not yet completed.
This error occurs when attempting to extract results from an operation that hasn’t finished yet. Use polling or await the operation’s future to wait for completion.
OperationsInFlight
Ring has operations in flight and cannot be dropped.
This error occurs when attempting to drop a Ring that still has pending operations. All operations must complete before the ring can be safely destroyed to prevent use-after-free bugs.
InvalidStateTransition
Invalid operation state transition.
This error occurs when attempting to transition an operation to an invalid state (e.g., submitting an already-submitted operation). The type system should prevent most of these at compile time.
NotRegistered
Resource is not registered.
This error occurs when attempting to use a file descriptor or buffer that hasn’t been registered with the ring, when registration is required for the operation.
PoolEmpty
Buffer pool is empty.
This error occurs when requesting a buffer from an empty pool. Consider increasing pool size or implementing fallback allocation.
PoolPoisoned
Buffer pool mutex is poisoned.
This error occurs when a thread panics while holding the pool’s mutex, leaving it in a poisoned state. The pool cannot be safely used after this.
Io(Error)
Standard I/O error.
This wraps standard library I/O errors, which can occur during file operations or when io_uring falls back to synchronous I/O.