Skip to main content

Error

Enum Error 

Source
#[non_exhaustive]
pub enum Error { BufferTooShort { need: usize, have: usize, what: &'static str, }, InvalidVersion(u8), InvalidValue { field: &'static str, value: u64, reason: &'static str, }, InvalidPadding { count: u8, reason: &'static str, }, ExtensionNotWordAligned { data_len: usize, }, NotRfc8285Extension { profile_id: u16, }, InvalidOneByteExtensionId(u8), InvalidTwoByteExtensionId, }
Expand description

An RTP header 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 (on parse) or output buffer (on serialize) shorter than required.

Fields

§need: usize

Bytes required.

§have: usize

Bytes available.

§what: &'static str

What was being parsed/serialized.

§

InvalidVersion(u8)

The 2-bit version field was not 2 (RFC 3550 §5.1: “The version defined by this specification is two (2)”).

§

InvalidValue

A field value did not fit its wire bit-width, or a derived count (CSRC list length, extension word count, padding octet count) overflowed its field.

Fields

§field: &'static str

The offending field/derived-count name.

§value: u64

The offending value.

§reason: &'static str

Why it is invalid.

§

InvalidPadding

The padding region (RFC 3550 §5.1) was malformed: either the trailing count byte was zero, exceeded the bytes actually available, or (on serialize) a supplied padding slice’s last byte did not equal its own length.

Fields

§count: u8

The padding-count byte (the last byte of the padding region).

§reason: &'static str

Why it is invalid.

§

ExtensionNotWordAligned

A header-extension data slice’s length was not a multiple of 4 bytes — RFC 3550 §5.3.1’s length field counts whole 32-bit words.

Fields

§data_len: usize

The offending data.len().

§

NotRfc8285Extension

Available on crate feature rfc8285 only.

(rfc8285 feature) A HeaderExtension’s profile_id matched neither the RFC 8285 one-byte form (0xBEDE) nor the two-byte form (profile_id & 0xFFF0 == 0x1000). This is not a malformed-packet error: RFC 8285 interpretation of the RFC 3550 §5.3.1 opaque extension data is profile-scoped and opt-in, so an extension with some other profile_id is simply not one this crate’s rfc8285 decoder understands.

Fields

§profile_id: u16

The offending HeaderExtension::profile_id.

§

InvalidOneByteExtensionId(u8)

Available on crate feature rfc8285 only.

(rfc8285 feature) An RFC 8285 one-byte-form local identifier was outside the valid 1..=14 range (§4.2: 0 is reserved for padding, 15 is reserved for a future extension / used as the “stop” marker).

§

InvalidTwoByteExtensionId

Available on crate feature rfc8285 only.

(rfc8285 feature) An RFC 8285 two-byte-form local identifier was 0 (§4.1.2 / §5: “0 is reserved for padding in both forms”).

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

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