Skip to main content

Error

Enum Error 

Source
#[non_exhaustive]
pub enum Error { BufferTooShort { need: usize, have: usize, what: &'static str, }, BerIndefiniteLength, BerLengthTooLong { bytes: usize, }, InvalidKeyLength { found: usize, }, UnknownPartitionKind { byte: u8, }, UnknownPartitionStatus { byte: u8, }, OpenFooterPartition { byte: u8, }, KeyPrefixMismatch { what: &'static str, }, MissingRequiredProperty { tag: u16, name: &'static str, set: &'static str, }, InvalidPropertyLength { tag: u16, name: &'static str, found: usize, expected: usize, }, InvalidBatchHeader { count: u32, item_len: u32, buffer_len: usize, }, InvalidUtf16 { tag: u16, name: &'static str, }, }
Expand description

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

§

BerIndefiniteLength

A BER length token used the reserved “unspecified length” value (0x80 with zero following bytes), forbidden in MXF files (docs/st377-1.md §6.3.4).

§

BerLengthTooLong

A BER long-form length used more following bytes than an unsigned 64-bit length could ever need, or than MXF’s own 9-byte cap (1 header + up to 8 length bytes, §6.3.4) allows.

Fields

§bytes: usize

Following-byte count found (or requested on serialize).

§

InvalidKeyLength

A KLV Key was not the expected 16 bytes ( §6.3.8 — MXF Keys and Universal Labels are always exactly 16 bytes; this only fires when a caller-supplied buffer is short, since crate::klv::KlvItem itself always reads exactly 16).

Fields

§found: usize

Bytes actually available for the key.

§

UnknownPartitionKind

A Partition Pack’s Key byte 14 (Partition Kind) was not one of the three defined values (docs/st377-1.md §7.1 Table 4).

Fields

§byte: u8

The offending byte 14 value.

§

UnknownPartitionStatus

A Partition Pack’s Key byte 15 (Partition Status) was not one of the four defined values (docs/st377-1.md §7.1 Table 4 / §6.2.3).

Fields

§byte: u8

The offending byte 15 value.

§

OpenFooterPartition

A Footer Partition Pack (Table 8) used an Open status byte, which §7.4.1’s note forbids (“Open Footer Partitions are not permitted”).

Fields

§byte: u8

The offending status byte.

§

KeyPrefixMismatch

A KLV Key did not match the expected fixed 13-byte Partition Pack / Primer Pack / Random Index Pack prefix (docs/st377-1.md §7.1 Table 4 / §9.2 Table 13 / §12.1 Table 29).

Fields

§what: &'static str

Which fixed-prefix pack was expected.

§

MissingRequiredProperty

A required Header Metadata property (Annex A) was absent from a typed Set’s underlying crate::LocalSet.

Fields

§tag: u16

The property’s local tag.

§name: &'static str

The property’s spec name.

§set: &'static str

The enclosing Set’s name.

§

InvalidPropertyLength

A property’s value had a length that does not match its fixed-size wire type (e.g. a 16-byte UUID field encoded with fewer/more bytes).

Fields

§tag: u16

The property’s local tag.

§name: &'static str

The property’s spec name.

§found: usize

Bytes found.

§expected: usize

Bytes expected.

§

InvalidBatchHeader

A Batch/Array’s 8-byte header (count: u32, item_len: u32) did not agree with the actual buffer length, or item_len did not match the expected fixed element size (docs/st377-1.md §4.3).

Fields

§count: u32

Declared element count.

§item_len: u32

Declared per-element length.

§buffer_len: usize

Actual remaining buffer length after the 8-byte header.

§

InvalidUtf16

A UTF-16 string property contained an invalid UTF-16 code unit sequence (unpaired surrogate).

Fields

§tag: u16

The property’s local tag.

§name: &'static str

The property’s spec name.

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.