#[non_exhaustive]pub enum TranscodeFailure {
Show 15 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,
},
InvalidProgress {
source: TranscodeContractError,
},
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
InvalidInputIndex
The caller supplied an input index outside the input slice.
Fields
InvalidOutputIndex
The caller supplied an output index outside the output slice.
Fields
InvalidOutputRange
The caller supplied an output range extending beyond the output slice.
Fields
InsufficientOutput
The output slice cannot hold all required output.
Fields
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
InvalidProgress
A transcoder returned progress inconsistent with the supplied buffers.
Fields
source: TranscodeContractErrorContract error describing the invalid progress.
TrailingInput
The input contains exactly one decoded value plus trailing units.
Fields
UnsupportedDecodeLifecycleOutput
A strict single-value decoder cannot expose codec lifecycle output.
Fields
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
impl TranscodeFailure
Sourcepub const fn invalid_input_index(index: usize, len: usize) -> Self
pub const fn invalid_input_index(index: usize, len: usize) -> Self
Creates an invalid-input-index error.
Sourcepub const fn invalid_output_index(index: usize, len: usize) -> Self
pub const fn invalid_output_index(index: usize, len: usize) -> Self
Creates an invalid-output-index error.
Sourcepub const fn invalid_output_range(
output_index: usize,
range_len: usize,
output_len: usize,
) -> Self
pub const fn invalid_output_range( output_index: usize, range_len: usize, output_len: usize, ) -> Self
Creates an invalid-output-range error.
Sourcepub const fn insufficient_output(
output_index: usize,
required: usize,
available: usize,
) -> Self
pub const fn insufficient_output( output_index: usize, required: usize, available: usize, ) -> Self
Creates an insufficient-output error.
Sourcepub const fn output_length_overflow() -> Self
pub const fn output_length_overflow() -> Self
Creates an output-length-overflow error.
Sourcepub const fn allocation_failed() -> Self
pub const fn allocation_failed() -> Self
Creates an output-allocation failure.
Sourcepub const fn incomplete_input(
input_index: usize,
required: usize,
available: usize,
) -> Self
pub const fn incomplete_input( input_index: usize, required: usize, available: usize, ) -> Self
Creates an incomplete-input error.
Sourcepub const fn invalid_progress(source: TranscodeContractError) -> Self
pub const fn invalid_progress(source: TranscodeContractError) -> Self
Creates an invalid-progress error.
Sourcepub const fn trailing_input(consumed: usize, remaining: usize) -> Self
pub const fn trailing_input(consumed: usize, remaining: usize) -> Self
Creates a trailing-input error.
Sourcepub const fn unsupported_decode_lifecycle_output(
reset_bound: usize,
finish_bound: usize,
) -> Self
pub const fn unsupported_decode_lifecycle_output( reset_bound: usize, finish_bound: usize, ) -> Self
Creates an unsupported decode-lifecycle-output error.
Sourcepub fn ensure_input_index(
input_len: usize,
input_index: usize,
) -> Result<(), Self>
pub fn ensure_input_index( input_len: usize, input_index: usize, ) -> Result<(), Self>
Validates that input_index is within an input slice.
Sourcepub fn ensure_min_input(
input_len: usize,
input_index: usize,
min_required: usize,
) -> Result<(), Self>
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.
Sourcepub fn ensure_no_trailing_input(
consumed: usize,
input_len: usize,
) -> Result<(), Self>
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.
Sourcepub fn ensure_output_index(
output_len: usize,
output_index: usize,
) -> Result<(), Self>
pub fn ensure_output_index( output_len: usize, output_index: usize, ) -> Result<(), Self>
Validates that output_index is within an output slice.
Sourcepub fn ensure_transcode_indices(
input_len: usize,
input_index: usize,
output_len: usize,
output_index: usize,
) -> Result<(), Self>
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.
Trait Implementations§
Source§impl Clone for TranscodeFailure
impl Clone for TranscodeFailure
Source§fn clone(&self) -> TranscodeFailure
fn clone(&self) -> TranscodeFailure
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for TranscodeFailure
Source§impl Debug for TranscodeFailure
impl Debug for TranscodeFailure
Source§impl Display for TranscodeFailure
impl Display for TranscodeFailure
impl Eq for TranscodeFailure
Source§impl Error for TranscodeFailure
impl Error for TranscodeFailure
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()
Source§impl From<CapacityError> for TranscodeFailure
impl From<CapacityError> for TranscodeFailure
Source§fn from(error: CapacityError) -> Self
fn from(error: CapacityError) -> Self
Converts capacity planning errors into transcode framework failures.
Source§impl From<TranscodeContractError> for TranscodeFailure
impl From<TranscodeContractError> for TranscodeFailure
Source§fn from(error: TranscodeContractError) -> Self
fn from(error: TranscodeContractError) -> Self
Converts a broken transcoder progress report into a framework failure.