Skip to main content

Error

Enum Error 

Source
#[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
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.
§

BufferTooShort

Input shorter than required.

Fields

§need: usize

Bytes required.

§have: usize

Bytes available.

§what: &'static str

What was being parsed.

§

OutputBufferTooSmall

The output buffer passed to serialize_into was too small.

Fields

§need: usize

Bytes required.

§have: usize

Bytes available.

§

FieldTooWide

A field value did not fit in its wire bit-width.

Fields

§what: &'static str

The over-wide field name.

§value: u64

The offending value.

§bits: u32

The field width on the wire.

§

InvalidAckLength

The Control Information Field length did not match any known ACK variant (Full / Small / Light — draft-sharabayko-srt-01 §3.2.4).

Fields

§len: usize

The CIF length actually found, in bytes.

§

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

Fields

§reason: &'static str

Why the loss list is invalid.

§

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

§declared: u16

The declared Extension Length (in 4-byte blocks).

§remaining: usize

The bytes actually remaining in the CIF.

§

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.

Fields

§field: &'static str

The offending field.

§reason: &'static str

Why it is invalid.

§

WrongPacketKind

A type-specific parse was called on bytes whose F bit (or Control Type) indicated the other packet kind.

Fields

§expected: &'static str

What the caller expected to parse.

§

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.

Fields

§what: &'static str

The offending field.

§value: u64

The non-zero value found.

§

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.

Fields

§what: &'static str

The offending field/value.

§reason: &'static str

Why it is invalid.

§

UnexpectedTrailingBytes

A Control Information Field documented as absent (Keep-Alive, Congestion Warning, Shutdown, ACKACK, Peer Error — §3.2) carried extra bytes.

Fields

§what: &'static str

What was being parsed.

§extra: usize

How many bytes were left over.

§

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.

Fields

§actual: &'static str

The Control Type label of the packet actually fed.

§

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

§state: &'static str

The state the handshake was in.

§reason: &'static str

Why the call is not valid there.

§

Io

Available on crate feature 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.

Fields

§kind: ErrorKind

The std::io::Error::kind() of the underlying OS error.

§context: &'static str

Which call site failed (e.g. "bind", "connect", "recv", "send").

Trait Implementations§

Source§

impl Clone for Error

Source§

fn clone(&self) -> Error

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 Debug for Error

Source§

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

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

impl Display for Error

Source§

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

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

impl Eq for Error

Source§

impl Error for Error

1.30.0 · Source§

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

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl PartialEq for Error

Source§

fn eq(&self, other: &Error) -> 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 Error

Auto Trait Implementations§

§

impl Freeze for Error

§

impl RefUnwindSafe for Error

§

impl Send for Error

§

impl Sync for Error

§

impl Unpin for Error

§

impl UnsafeUnpin for Error

§

impl UnwindSafe for Error

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.

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> Same for T

Source§

type Output = T

Should always be Self
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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.