#[non_exhaustive]pub enum StateError {
StreamAlreadyActive {
already_active: StreamId,
requested: StreamId,
},
VoiceSeqOutOfRange {
got: u8,
},
UnknownStreamId {
stream_id: StreamId,
},
WrongState {
operation: &'static str,
state: ClientStateKind,
protocol: ProtocolKind,
},
}Expand description
Runtime state-machine errors that the typestate cannot prevent.
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.
StreamAlreadyActive
send_header for stream X while stream Y is still streaming.
Fields
VoiceSeqOutOfRange
send_voice with seq > 20 (D-STAR seq is mod 21).
UnknownStreamId
Receive callback fired for a stream id with no known session state.
WrongState
A method was called on a SessionCore while it was in the
wrong ClientStateKind — e.g. enqueue_connect outside of
Configured/Authenticated, or attach_host_list on a
non-DPlus session.
The typestate wrapper (crate::session::client::Session) prevents
this at compile time; the variant exists so direct SessionCore
users (tests + the protocol-erased fallback) get a useful
runtime error instead of a panic.
Fields
§
state: ClientStateKindThe current runtime state.
§
protocol: ProtocolKindThe runtime protocol discriminator.
Trait Implementations§
Source§impl Clone for StateError
impl Clone for StateError
Source§fn clone(&self) -> StateError
fn clone(&self) -> StateError
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for StateError
impl Debug for StateError
Source§impl Display for StateError
impl Display for StateError
Source§impl Error for StateError
impl Error for StateError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
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
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Source§impl From<StateError> for Error
impl From<StateError> for Error
Source§fn from(value: StateError) -> Self
fn from(value: StateError) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for StateError
impl RefUnwindSafe for StateError
impl Send for StateError
impl Sync for StateError
impl Unpin for StateError
impl UnwindSafe for StateError
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
Mutably borrows from an owned value. Read more