Skip to main content

DraftSpecificCause

Enum DraftSpecificCause 

Source
pub enum DraftSpecificCause {
    LocalRefusal,
    PeerViolation {
        rule: AboveCodecRule,
        close: Option<u64>,
    },
}
Expand description

What one of a draft’s own ConnectionError variants is — the ones outside the ten every draft shares.

Returned by Connection::draft_specific_cause, which every draft implements exhaustively over its own error type. None from that function means the variant is one of the shared ten, which crate::dispatch::AnyConnectionError classifies itself and never asks a draft about.

The split is the whole point: the two are opposite findings, one this build declining to do something and the other a relay having done something the draft forbids. Without it both reach a consumer as prose.

Variants§

§

LocalRefusal

This endpoint refused the call. Nothing was written and no state moved.

A message handed to the control stream that belongs on a request stream, a respond_* helper pointed at a request this endpoint opened, a FIN asked for before the response the draft requires first, an object asked for before the header it is framed against. Every one of them is this side being told to do something it will not do, and every one of them reaches crate::dispatch::ErrorCause::Facade.

§And one that is not a call at all

ConnectionError::ControlMessageNarrowing is the odd member, and it is here for the reason the rest are rather than because it looks like them. Every draft’s recv_control decodes into AnyControlMessage and then narrows the result to its own draft, and the arm that catches a narrowing that did not work is unreachable: the decoder was this draft’s, so the variant can only be this draft’s. Nothing pins that.

Spelled as CodecError::UnknownMessageType(0) the placeholder would not stay inert. Every draft’s codec_session_error_code answers that variant Some(PROTOCOL_VIOLATION), so an unreachable arm being reached would reach a caller as the peer sent a control message type this draft does not assign, and the session must be closed with a Protocol Violation — with 0x00 riding along as the codepoint that proved it. A conformance report reading that publishes a named accusation against a relay, carrying a piece of evidence, for a defect in this build. Better dressed than any accusation it makes on real grounds, and false.

So it is a variant of its own and it answers here. That does not make the arm reachable; it makes reaching it say this build declined rather than the peer violated, with no rule and no close code for anything downstream to read out of it.

§

PeerViolation

The peer broke a rule this endpoint enforces above its decoder.

Fields

§rule: AboveCodecRule

Which rule, named the same way on every draft that states it.

§close: Option<u64>

The session error code this draft’s own text requires be sent for it, where it names one.

Exactly the contract crate::dispatch::ErrorCause::Codec gives close, and for the same reason: a rule a draft attaches no consequence to is not grounds to name a peer.

Trait Implementations§

Source§

impl Clone for DraftSpecificCause

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 DraftSpecificCause

Source§

impl Debug for DraftSpecificCause

Source§

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

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

impl Eq for DraftSpecificCause

Source§

impl PartialEq for DraftSpecificCause

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 DraftSpecificCause

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.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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, !>

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

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more