#[non_exhaustive]#[repr(u32)]pub enum Code {
Show 14 variants
Ok = 0,
ShapeMismatch = 1,
Locked = 2,
Busy = 3,
NotFound = 4,
WrongType = 5,
AbiMismatch = 6,
Corrupt = 7,
Full = 8,
Io = 9,
Unsupported = 10,
Invalid = 11,
EpochStalled = 12,
VersionTooNew = 13,
}Expand description
A stable, wire visible condition code.
These numbers are frozen once released. They are the same integers the C
ABI exposes as yo_code and the same ones every binding reports.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Ok = 0
Not an error. Present so that the C enum has a zero value that means success.
C name: YO_OK.
ShapeMismatch = 1
The type used to open a collection does not match the type the collection was created with. The message carries both shape descriptions in full, not just the tags.
C name: YO_ERR_SHAPE_MISMATCH.
Locked = 2
Another process holds the writer lock on this file. Exactly one writer per file.
C name: YO_ERR_LOCKED.
Busy = 3
The handle has live children. Closing a parent with live children closes nothing.
C name: YO_ERR_BUSY.
NotFound = 4
The key, field, member or node does not exist. This is a value and not a failure, and the typed API returns an Option rather than this error wherever it can.
C name: YO_ERR_NOT_FOUND.
WrongType = 5
The key holds a different data structure than the operation expects. This is Redis WRONGTYPE.
C name: YO_ERR_WRONG_TYPE.
AbiMismatch = 6
The header the caller compiled against and the library it loaded disagree. The message names both versions.
C name: YO_ERR_ABI_MISMATCH.
Corrupt = 7
A checksum failed or a structure is self-inconsistent. The message names the offset and what was expected there.
C name: YO_ERR_CORRUPT.
Full = 8
A bounded resource is exhausted: the address space, a fixed table, or a configured memory limit.
C name: YO_ERR_FULL.
Io = 9
The operating system refused an operation. The detail field carries errno and the path.
C name: YO_ERR_IO.
Unsupported = 10
The operation is valid but this build or this platform does not implement it. The message says which build would.
C name: YO_ERR_UNSUPPORTED.
Invalid = 11
The arguments are wrong. The position field points at which one.
C name: YO_ERR_INVALID.
EpochStalled = 12
An iterator has been open long enough to hold back reclamation. Finish it or drop it. The message carries the iterator age in microseconds.
C name: YO_ERR_EPOCH_STALLED.
VersionTooNew = 13
The file’s min_reader_version is higher than this build supports. The message names both numbers and the release that would read it.
C name: YO_ERR_VERSION_TOO_NEW.
Implementations§
Source§impl Code
impl Code
Sourcepub const fn from_u32(v: u32) -> Option<Code>
pub const fn from_u32(v: u32) -> Option<Code>
The code for a wire value, or None if this build does not know it.
An unknown code from a newer peer is a value to report, not a panic.
Sourcepub const fn c_name(self) -> &'static str
pub const fn c_name(self) -> &'static str
The C ABI spelling, which is also what appears in log lines.
Sourcepub const fn is_retryable(self) -> bool
pub const fn is_retryable(self) -> bool
Whether the identical call could succeed later.
This is a property of the condition and not of the caller, which is why it is generated rather than decided at each call site.
Sourcepub const fn c_name_z(self) -> &'static str
pub const fn c_name_z(self) -> &'static str
The C ABI spelling with a trailing NUL, ready to cross the boundary.
The C ABI needs NUL terminated strings and Rust literals are not, so the terminator is put here where it is generated rather than in a second table somebody has to keep in step by hand.