#[non_exhaustive]pub enum Error {
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,
},
}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.
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()