pub enum ResponseCode {
Show 18 variants Success, Continuation, NeedsAuthentication, Forbidden, Closing, Errno, AuthenticationFailed, Gone, NotFound, InternalError, ChannelDead, NotEnabled, NotSupported, ParametersNotSupported, Invalid, TooLarge, TooManyMessages, InvalidParameters,
}
Expand description

Overview

The protocol is relatively simple. Each request consists of a 32-bit size of the resulting message, a 32-bit request ID, a 32-bit message type, and an optional per-message CBOR blob representing message data. For performance and security reasons, the message size is limited to 2^24 in size. The size includes all fields other than the size.

Each response consists of a 32-bit size of the message, the 32-bit request ID, a 32-bit response code, and an optional per-response code CBOR blob.

The bottom 31 bits of the request ID may be any value; the response will use the same ID. No check is made for duplicates, so the requestor should prefer not repeating IDs that are in flight. The top bit is clear if the request is client-to-server request and it is set if the request is a server-to-client request. This helps eliminate confusion as to whether a message is a request or a response.

All data is serialized in a little-endian format. The response codes for the protocol.

The response codes are based around IMAP’s response codes, and the top two bytes of the response indicates the type:

  • 0: success
  • 1: no (roughly, the request was understood, but not completed)
  • 2: bad (roughly, the request was not understood)

Variants§

§

Success

The request was successful. The response contains the requested data.

§

Continuation

The request is incomplete, but is so far successful. The request should continue, referencing the ID of the last request.

§

NeedsAuthentication

The request requires authentication.

The semantics for this message are equivalent to an HTTP 401 response.

§

Forbidden

The message was not allowed.

The semantics for this message are equivalent to an HTTP 403 response.

§

Closing

The server is shutting down.

§

Errno

The message failed for a system error reason.

This is generally only useful for certain types of channels.

§

AuthenticationFailed

§

Gone

The other end of the channel has disappeared.

§

NotFound

§

InternalError

§

ChannelDead

The channel has ceased to produce new data and this operation cannot complete.

§

NotEnabled

The message type was not enabled.

§

NotSupported

The message type was not supported.

§

ParametersNotSupported

The parameters were not supported.

§

Invalid

The message type was received, but was not valid.

§

TooLarge

The message was too large.

§

TooManyMessages

There are too many pending messages.

§

InvalidParameters

The parameters are supported, but not correct.

For example, if a selector is not valid for a channel, this message may be sent.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Converts to this type from the input type.
Converts an i64 to return an optional value of this type. If the value cannot be represented by this type, then None is returned. Read more
Converts an u64 to return an optional value of this type. If the value cannot be represented by this type, then None is returned. Read more
Converts an isize to return an optional value of this type. If the value cannot be represented by this type, then None is returned. Read more
Converts an i8 to return an optional value of this type. If the value cannot be represented by this type, then None is returned. Read more
Converts an i16 to return an optional value of this type. If the value cannot be represented by this type, then None is returned. Read more
Converts an i32 to return an optional value of this type. If the value cannot be represented by this type, then None is returned. Read more
Converts an i128 to return an optional value of this type. If the value cannot be represented by this type, then None is returned. Read more
Converts a usize to return an optional value of this type. If the value cannot be represented by this type, then None is returned. Read more
Converts an u8 to return an optional value of this type. If the value cannot be represented by this type, then None is returned. Read more
Converts an u16 to return an optional value of this type. If the value cannot be represented by this type, then None is returned. Read more
Converts an u32 to return an optional value of this type. If the value cannot be represented by this type, then None is returned. Read more
Converts an u128 to return an optional value of this type. If the value cannot be represented by this type, then None is returned. Read more
Converts a f32 to return an optional value of this type. If the value cannot be represented by this type, then None is returned. Read more
Converts a f64 to return an optional value of this type. If the value cannot be represented by this type, then None is returned. Read more
This method returns an Ordering between self and other. Read more
Compares and returns the maximum of two values. Read more
Compares and returns the minimum of two values. Read more
Restrict a value to a certain interval. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more
This method returns an ordering between self and other values if one exists. Read more
This method tests less than (for self and other) and is used by the < operator. Read more
This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
This method tests greater than (for self and other) and is used by the > operator. Read more
This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.