Skip to main content

GeneralCode

Enum GeneralCode 

Source
#[repr(u16)]
pub enum GeneralCode {
Show 18 variants Success = 0, Failure = 1, BadPrecondition = 2, OutOfRange = 3, BadRequest = 4, Unsupported = 5, Unexpected = 6, ResourceExhausted = 7, Busy = 8, Timeout = 9, Continue = 10, Aborted = 11, InvalidArgument = 12, NotFound = 13, AlreadyExists = 14, PermissionDenied = 15, DataLoss = 16, MessageTooLarge = 17,
}
Expand description

The uniform status codes of Appendix D.3.1.

Exhaustive on purpose: the specification closes this set, so a match on it should be checked for completeness when a future revision adds one.

Variants§

§

Success = 0

Operation completed successfully.

§

Failure = 1

Generic failure; the protocol-specific code says more.

§

BadPrecondition = 2

“Operation was rejected by the system because the system is in an invalid state.”

§

OutOfRange = 3

A value was out of a required range.

§

BadRequest = 4

A request was unrecognized or malformed.

§

Unsupported = 5

An unrecognized or unsupported request was received.

§

Unexpected = 6

A request was not expected at this time.

§

ResourceExhausted = 7

Insufficient resources to process the given request.

§

Busy = 8

Device is busy and cannot handle this request at this time.

§

Timeout = 9

A timeout occurred.

§

Continue = 10

Context-specific signal to proceed.

§

Aborted = 11

Failure, may be due to a concurrency error.

§

InvalidArgument = 12

An invalid or unsupported argument was provided.

§

NotFound = 13

Some requested entity was not found.

§

AlreadyExists = 14

The sender attempted to create something that already exists.

§

PermissionDenied = 15

The sender does not have sufficient permissions.

§

DataLoss = 16

Unrecoverable data loss or corruption has occurred.

§

MessageTooLarge = 17

“Message size is larger than the recipient can handle” — what a node answers when a peer announces a message above its Maximum Message Size (§4.15.2.3).

Implementations§

Source§

impl GeneralCode

Source

pub const fn from_u16(value: u16) -> Result<Self>

Decodes the wire value.

Source

pub const fn is_success(self) -> bool

Whether this code reports success.

Continue counts: Appendix D.3.2 groups it with Success as the two codes for which ProtocolCode 0 is a placeholder rather than a real code.

Trait Implementations§

Source§

impl Clone for GeneralCode

Source§

fn clone(&self) -> Self

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 GeneralCode

Source§

impl Debug for GeneralCode

Source§

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

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

impl Eq for GeneralCode

Source§

impl Hash for GeneralCode

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 PartialEq for GeneralCode

Source§

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

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

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for GeneralCode

Auto Trait Implementations§

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> Same for T

Source§

type Output = T

Should always be Self
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, !>

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.