pub enum ProtocolError {
PayloadMismatch {
expected: Payload,
got: Payload,
},
UnexpectedFrame {
cursor_kind: &'static str,
frame_kind: &'static str,
},
UnknownLabel {
label: String,
expected: Vec<String>,
},
CreditExhausted {
payload: Payload,
budget: u64,
},
AlreadyComplete {
frame_kind: &'static str,
},
MalformedFrame(String),
Transport(String),
}Expand description
Runtime protocol violation — the peer’s next frame is inconsistent with the session-type cursor or with the credit window.
Variants§
PayloadMismatch
The cursor expected a send/recv of payload expected but the
peer’s frame announced payload got. The static type discipline is
violated — at runtime this means the peer is not running the dual
of our declared role.
UnexpectedFrame
The cursor expected an operation of one kind (e.g. recv) but the
peer’s frame announced another (e.g. select). The connection state
machine has no transition rule for the observed input.
UnknownLabel
The cursor is at an internal/external choice and the peer’s label is not in the type’s arm set. Lists the declared labels so the peer can recover.
CreditExhausted
A send was attempted at zero available credit — the §Fase 41.c
“no rule at n = 0” axiom (paper §4.2) projected onto the runtime.
Static analysis (credit_analyse) catches this at compile time
when the declared protocol demands more than k sends in a burst;
at runtime it is the dynamic-safety net for an off-spec peer.
AlreadyComplete
The cursor has reached end but the peer sent more data, or the
peer requested an action while we already closed our half.
MalformedFrame(String)
The frame did not parse as a well-formed AXON session-typed
envelope (malformed JSON, unknown kind, missing required field).
Carries the raw payload for diagnostics.
Transport(String)
The transport (WebSocket) returned an I/O error or was closed abruptly mid-dialogue.
Implementations§
Trait Implementations§
Source§impl Clone for ProtocolError
impl Clone for ProtocolError
Source§fn clone(&self) -> ProtocolError
fn clone(&self) -> ProtocolError
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ProtocolError
impl Debug for ProtocolError
Source§impl Display for ProtocolError
impl Display for ProtocolError
impl Eq for ProtocolError
Source§impl Error for ProtocolError
impl Error for ProtocolError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl PartialEq for ProtocolError
impl PartialEq for ProtocolError
Source§fn eq(&self, other: &ProtocolError) -> bool
fn eq(&self, other: &ProtocolError) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for ProtocolError
Auto Trait Implementations§
impl Freeze for ProtocolError
impl RefUnwindSafe for ProtocolError
impl Send for ProtocolError
impl Sync for ProtocolError
impl Unpin for ProtocolError
impl UnsafeUnpin for ProtocolError
impl UnwindSafe for ProtocolError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more