Skip to main content

SessionConfigError

Enum SessionConfigError 

Source
#[non_exhaustive]
pub enum SessionConfigError { MissingField { field: &'static str, }, EmptyField { field: &'static str, }, FieldTooLong { field: &'static str, len: usize, max: usize, }, IllegalByte { field: &'static str, byte: u8, position: usize, }, FractionalHeartbeatInterval { interval: Duration, }, HeartbeatIntervalOutOfRange { secs: u64, min: u64, max: u64, }, HeartbeatDisabledWithoutOptIn, TimeoutOutOfRange { field: &'static str, timeout: Duration, max: Duration, }, MessageSizeLimitOutOfRange { size: usize, min: usize, max: usize, }, }
Expand description

Reason a session configuration cannot be used.

Every variant names the offending knob, so the message is actionable without the caller having to guess which setter produced it.

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.
§

MissingField

A field with no default was never set on the builder.

Fields

§field: &'static str

Name of the field that was never set.

§

EmptyField

A string knob was set to the empty string.

An empty value has no wire form: the encoder refuses it, so it would fail at the first outbound message rather than at configuration time.

Fields

§field: &'static str

Name of the empty field.

§

FieldTooLong

A string knob is longer than MAX_ID_LEN bytes.

Fields

§field: &'static str

Name of the oversized field.

§len: usize

Length of the configured value, in bytes.

§max: usize

The maximum accepted, in bytes.

§

IllegalByte

A string knob carries a byte with no on-the-wire form.

These values are written verbatim into the standard header, so SOH would terminate the field early and = would open a new tag/value pair: either byte structurally corrupts every outbound message.

Fields

§field: &'static str

Name of the offending field.

§byte: u8

The byte that was refused.

§position: usize

Its zero-based position in the value.

§

FractionalHeartbeatInterval

The heartbeat interval is not a whole number of seconds.

Fields

§interval: Duration

The configured interval.

§

HeartbeatIntervalOutOfRange

The heartbeat interval is outside the supported range.

Fields

§secs: u64

The configured interval, in seconds.

§min: u64

The smallest interval accepted, in seconds.

§max: u64

The largest interval accepted, in seconds.

§

HeartbeatDisabledWithoutOptIn

A zero heartbeat interval reached the builder without the explicit opt-in.

HeartBtInt = 0 is legal and means “do not heartbeat”, which switches dead-peer detection off for the whole session. That is a decision, not a default, so it has to be asked for by name.

§

TimeoutOutOfRange

A handshake timeout is zero or above MAX_TIMEOUT.

Fields

§field: &'static str

Name of the offending timeout.

§timeout: Duration

The configured timeout.

§max: Duration

The largest timeout accepted.

§

MessageSizeLimitOutOfRange

max_message_size is outside its supported range.

Fields

§size: usize

The configured limit, in bytes.

§min: usize

The smallest limit accepted, in bytes.

§max: usize

The largest limit accepted, in bytes.

Trait Implementations§

Source§

impl Clone for SessionConfigError

Source§

fn clone(&self) -> SessionConfigError

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 Debug for SessionConfigError

Source§

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

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

impl Display for SessionConfigError

Source§

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

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

impl Eq for SessionConfigError

Source§

impl Error for SessionConfigError

1.30.0 · Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl PartialEq for SessionConfigError

Source§

fn eq(&self, other: &SessionConfigError) -> 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 SessionConfigError

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> 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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.