pub enum TranscodeError<E> {
InvalidInputIndex {
index: usize,
len: usize,
},
InvalidOutputIndex {
index: usize,
len: usize,
},
InsufficientOutput {
output_index: usize,
required: usize,
available: usize,
},
OutputLengthOverflow,
Domain(E),
}Expand description
Error reported by a transcode operation.
Buffer contract failures are framework errors owned by the transcode layer and are represented directly by this enum. Codec-, charset-, or policy-specific failures are carried as domain errors.
§Type Parameters
E: Domain error reported by the concrete transcoder.
Variants§
InvalidInputIndex
The caller supplied an input index outside the input slice.
Fields
InvalidOutputIndex
The caller supplied an output index outside the output slice.
Fields
InsufficientOutput
The output slice cannot hold all required output.
Fields
OutputLengthOverflow
Output length arithmetic overflowed.
Domain(E)
Domain-specific codec, charset, or policy error.
Implementations§
Source§impl<E> TranscodeError<E>
impl<E> TranscodeError<E>
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 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 domain_ref(&self) -> Option<&E>
pub const fn domain_ref(&self) -> Option<&E>
Borrows the wrapped domain error.
§Returns
Returns Some(error) for TranscodeError::Domain and None for
buffer contract errors.
Sourcepub fn map_domain<F, T>(self, f: F) -> TranscodeError<T>where
F: FnOnce(E) -> T,
pub fn map_domain<F, T>(self, f: F) -> TranscodeError<T>where
F: FnOnce(E) -> T,
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_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<E: Clone> Clone for TranscodeError<E>
impl<E: Clone> Clone for TranscodeError<E>
Source§fn clone(&self) -> TranscodeError<E>
fn clone(&self) -> TranscodeError<E>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl<E: Copy> Copy for TranscodeError<E>
Source§impl<E: Debug> Debug for TranscodeError<E>
impl<E: Debug> Debug for TranscodeError<E>
Source§impl<E> Display for TranscodeError<E>where
E: Display,
impl<E> Display for TranscodeError<E>where
E: Display,
impl<E: Eq> Eq for TranscodeError<E>
Source§impl<E> Error for TranscodeError<E>
impl<E> Error for TranscodeError<E>
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<E> From<CapacityError> for TranscodeError<E>
impl<E> From<CapacityError> for TranscodeError<E>
Source§fn from(error: CapacityError) -> Self
fn from(error: CapacityError) -> Self
Converts capacity planning errors into transcode framework errors.
Source§impl<E: Hash> Hash for TranscodeError<E>
impl<E: Hash> Hash for TranscodeError<E>
Source§impl<E: PartialEq> PartialEq for TranscodeError<E>
impl<E: PartialEq> PartialEq for TranscodeError<E>
Source§fn eq(&self, other: &TranscodeError<E>) -> bool
fn eq(&self, other: &TranscodeError<E>) -> bool
self and other values to be equal, and is used by ==.