Skip to main content

TranscodeFailure

Enum TranscodeFailure 

Source
#[non_exhaustive]
pub enum TranscodeFailure {
Show 14 variants InvalidInputIndex { index: usize, input_len: usize, }, InvalidOutputIndex { index: usize, output_len: usize, }, InvalidOutputRange { output_index: usize, range_len: usize, output_len: usize, }, InsufficientOutput { output_index: usize, required: usize, available: usize, }, OutputLengthOverflow, AllocationFailed, IncompleteInput { input_index: usize, required: usize, available: usize, }, TrailingInput { consumed: usize, remaining: usize, }, UnsupportedDecodeLifecycleOutput { reset_bound: usize, finish_bound: usize, }, TranscodeAfterFinish, TranscodeBeforeReset, FinishAfterFinish, FinishBeforeReset, LifecyclePoisoned,
}
Expand description

Framework-level failure reported by a transcode operation.

These failures are part of the safe public transcode API. They describe caller-supplied buffer ranges, capacity planning, complete-input shape, and stream lifecycle misuse that the transcode layer can detect without interpreting a concrete codec 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.
§

InvalidInputIndex

The caller supplied an input index outside the input slice.

Fields

§index: usize

Invalid input index supplied by the caller.

§input_len: usize

Length of the input slice.

§

InvalidOutputIndex

The caller supplied an output index outside the output slice.

Fields

§index: usize

Invalid output index supplied by the caller.

§output_len: usize

Length of the output slice.

§

InvalidOutputRange

The caller supplied an output range extending beyond the output slice.

Fields

§output_index: usize

Absolute output index where the range starts.

§range_len: usize

Length of the caller-supplied output range.

§output_len: usize

Length of the output slice.

§

InsufficientOutput

The output slice cannot hold all required output.

Fields

§output_index: usize

Absolute output index where writing would start.

§required: usize

Output units required from output_index.

§available: usize

Output units available from output_index.

§

OutputLengthOverflow

Output length arithmetic overflowed.

§

AllocationFailed

The allocator could not reserve the requested output storage.

§

IncompleteInput

The complete input ended with an incomplete value.

Fields

§input_index: usize

Absolute input index where the incomplete value starts.

§required: usize

Current minimum total input units required from input_index before retrying. A later retry may raise this lower bound.

§available: usize

Input units available from input_index.

§

TrailingInput

The input contains exactly one decoded value plus trailing units.

Fields

§consumed: usize

Units consumed by the decoded value.

§remaining: usize

Extra units left after the decoded value.

§

UnsupportedDecodeLifecycleOutput

A strict single-value decoder cannot expose codec lifecycle output.

Fields

§reset_bound: usize

Maximum values the codec may emit while resetting decode state.

§finish_bound: usize

Maximum values the codec may emit while finishing decode state.

§

TranscodeAfterFinish

transcode was called after the logical stream was finished.

§

TranscodeBeforeReset

transcode was called before the first successful reset.

§

FinishAfterFinish

finish was called after the logical stream was already finished.

§

FinishBeforeReset

finish was called before the first successful reset.

§

LifecyclePoisoned

Reset or finish failed after codec, hook, or buffered state may have changed. Continuing could repeat side effects or observe inconsistent state; a successful reset is required before further use.

Implementations§

Source§

impl TranscodeFailure

Source

pub const fn invalid_input_index(index: usize, len: usize) -> Self

Creates an invalid-input-index error.

Source

pub const fn invalid_output_index(index: usize, len: usize) -> Self

Creates an invalid-output-index error.

Source

pub const fn invalid_output_range( output_index: usize, range_len: usize, output_len: usize, ) -> Self

Creates an invalid-output-range error.

Source

pub const fn insufficient_output( output_index: usize, required: usize, available: usize, ) -> Self

Creates an insufficient-output error.

Source

pub const fn output_length_overflow() -> Self

Creates an output-length-overflow error.

Source

pub const fn allocation_failed() -> Self

Creates an output-allocation failure.

Source

pub const fn incomplete_input( input_index: usize, required: usize, available: usize, ) -> Self

Creates an incomplete-input error.

Source

pub const fn trailing_input(consumed: usize, remaining: usize) -> Self

Creates a trailing-input error.

Source

pub const fn unsupported_decode_lifecycle_output( reset_bound: usize, finish_bound: usize, ) -> Self

Creates an unsupported decode-lifecycle-output error.

Source

pub fn ensure_input_index( input_len: usize, input_index: usize, ) -> Result<(), Self>

Validates that input_index is within an input slice.

Source

pub fn ensure_min_input( input_len: usize, input_index: usize, min_required: usize, ) -> Result<(), Self>

Validates that enough input units are available from input_index.

Source

pub fn ensure_no_trailing_input( consumed: usize, input_len: usize, ) -> Result<(), Self>

Validates a consumed input count and rejects trailing input.

§Parameters
  • consumed: Number of input units consumed by the decoded value.
  • input_len: Total number of input units supplied.
§Returns

Returns Ok(()) when consumed == input_len.

§Errors

Returns TranscodeFailure::InvalidInputIndex when consumed exceeds input_len, or TranscodeFailure::TrailingInput when unconsumed input remains.

Source

pub fn ensure_output_index( output_len: usize, output_index: usize, ) -> Result<(), Self>

Validates that output_index is within an output slice.

Source

pub fn ensure_transcode_indices( input_len: usize, input_index: usize, output_len: usize, output_index: usize, ) -> Result<(), Self>

Validates input and output start indices for a transcode call.

Source

pub fn ensure_output_capacity( output_len: usize, output_index: usize, required: usize, ) -> Result<(), Self>

Validates that an output slice can hold one-shot finalization output.

Source

pub fn ensure_output_range( output_len: usize, output_index: usize, range_len: usize, required: usize, ) -> Result<(), Self>

Validates an indexed output range and its minimum writable capacity.

Trait Implementations§

Source§

impl Clone for TranscodeFailure

Source§

fn clone(&self) -> TranscodeFailure

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 TranscodeFailure

Source§

impl Debug for TranscodeFailure

Source§

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

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

impl Display for TranscodeFailure

Source§

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

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

impl Eq for TranscodeFailure

Source§

impl Error for TranscodeFailure

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 From<CapacityError> for TranscodeFailure

Source§

fn from(error: CapacityError) -> Self

Converts capacity planning errors into transcode framework failures.

Source§

impl<DE, EE, V> From<TranscodeFailure> for TranscodeConvertError<DE, EE, V>

Source§

fn from(source: TranscodeFailure) -> Self

Converts to this type from the input type.
Source§

impl<E> From<TranscodeFailure> for TranscodeDecodeError<E>

Source§

fn from(source: TranscodeFailure) -> Self

Converts to this type from the input type.
Source§

impl<E, V> From<TranscodeFailure> for TranscodeEncodeError<E, V>

Source§

fn from(source: TranscodeFailure) -> Self

Converts to this type from the input type.
Source§

impl Hash for TranscodeFailure

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for TranscodeFailure

Source§

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

Auto Trait Implementations§

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 = !

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.