Skip to main content

Code

Enum Code 

Source
#[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
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

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

Source

pub const ALL: &'static [Code]

Every code, in wire order. Index equals the numeric value.

Source

pub const fn as_u32(self) -> u32

The wire value.

Source

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.

Source

pub const fn c_name(self) -> &'static str

The C ABI spelling, which is also what appears in log lines.

Source

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.

Source

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.

Source

pub const fn url_z(self) -> Option<&'static str>

The documentation page with a trailing NUL, if there is one.

Source

pub const fn url(self) -> Option<&'static str>

The documentation page for this condition, if it has one.

Trait Implementations§

Source§

impl Clone for Code

Source§

fn clone(&self) -> Code

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Code

Source§

impl Debug for Code

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for Code

Source§

impl Hash for Code

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Ord for Code

Source§

fn cmp(&self, other: &Code) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

fn clamp_to<R>(self, range: R) -> Self
where Self: Sized, R: ClampBounds<Self>,

🔬This is a nightly-only experimental API. (clamp_to)
Restrict a value to a certain range. Read more
Source§

impl PartialEq for Code

Source§

fn eq(&self, other: &Code) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl PartialOrd for Code

Source§

fn partial_cmp(&self, other: &Code) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl StructuralPartialEq for Code

Auto Trait Implementations§

§

impl Freeze for Code

§

impl RefUnwindSafe for Code

§

impl Send for Code

§

impl Sync for Code

§

impl Unpin for Code

§

impl UnsafeUnpin for Code

§

impl UnwindSafe for Code

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.