#[non_exhaustive]pub enum Error {
Show 15 variants
BufferTooShort {
need: usize,
have: usize,
what: &'static str,
},
OutputBufferTooSmall {
need: usize,
have: usize,
},
FieldTooWide {
what: &'static str,
value: u64,
bits: u32,
},
InvalidAckLength {
len: usize,
},
InvalidLossList {
reason: &'static str,
},
ExtensionOverrun {
declared: u16,
remaining: usize,
},
InvalidStreamIdUtf8,
InvalidKeyMaterial {
field: &'static str,
reason: &'static str,
},
WrongPacketKind {
expected: &'static str,
},
ReservedFieldNotZero {
what: &'static str,
value: u64,
},
InvalidField {
what: &'static str,
reason: &'static str,
},
UnexpectedTrailingBytes {
what: &'static str,
extra: usize,
},
UnexpectedControlPacket {
actual: &'static str,
},
HandshakeOutOfSequence {
state: &'static str,
reason: &'static str,
},
Io {
kind: ErrorKind,
context: &'static str,
},
}Expand description
An SRT packet parse / serialize error.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
BufferTooShort
Input shorter than required.
Fields
OutputBufferTooSmall
The output buffer passed to serialize_into was too small.
FieldTooWide
A field value did not fit in its wire bit-width.
Fields
InvalidAckLength
The Control Information Field length did not match any known ACK
variant (Full / Small / Light — draft-sharabayko-srt-01 §3.2.4).
InvalidLossList
A NAK loss-list (draft-sharabayko-srt-01 Appendix A) was not a whole
number of 4-byte entries, or a range entry’s second word had its top
bit set (which would make it a nested range).
ExtensionOverrun
A Handshake Extension block’s declared length (in 4-byte units)
overran the remaining CIF bytes (draft-sharabayko-srt-01 §3.2.1).
Fields
InvalidStreamIdUtf8
The Stream ID extension contents were not valid UTF-8 after undoing the
32-bit little-endian word storage (draft-sharabayko-srt-01 §3.2.1.3).
InvalidKeyMaterial
A Key Material message (draft-sharabayko-srt-01 §3.2.2) fixed-value
field did not carry its mandated value.
WrongPacketKind
A type-specific parse was called on bytes whose F bit (or Control
Type) indicated the other packet kind.
ReservedFieldNotZero
A field documented as reserved / must-be-zero (draft-sharabayko-srt-01
§3.2, e.g. Subtype on a defined control type, or the header
Type-specific Information word where the packet type does not use
it) carried a non-zero value.
InvalidField
A general structural constraint (not a bit-width overflow) was violated — e.g. a length that must be a whole number of 4-byte words.
UnexpectedTrailingBytes
A Control Information Field documented as absent (Keep-Alive, Congestion Warning, Shutdown, ACKACK, Peer Error — §3.2) carried extra bytes.
UnexpectedControlPacket
The handshake state machine (crate::caller/crate::listener) was
fed a control packet that is not a Handshake packet
(draft-sharabayko-srt-01 §3.2.1) — only Handshake packets
participate in the exchange modeled there.
HandshakeOutOfSequence
A handshake state-machine call happened in a state where the draft’s
flow (draft-sharabayko-srt-01 §4.3.1) does not expect it — a driver
bug (e.g. calling start() twice, or feed() after Connected),
not a peer protocol failure.
Fields
Io
std only.A real-socket I/O failure surfaced by crate::io’s tokio adapter
(feature tokio, which implies std). Carries the OS
std::io::ErrorKind — so e.g. a bind failure (AddrInUse) is
distinguishable from a mid-connection reset (ConnectionReset) — plus
a fixed context naming the failing call site ("bind", "connect",
"recv", "send", …). std::io::Error itself is not
Clone/PartialEq/Eq (this enum derives all three), so only its
kind() is kept rather than the full error.
Trait Implementations§
impl Eq for Error
Source§impl Error for Error
impl Error for Error
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()