pub enum CodecEncodeError<E> {
Encode {
source: E,
input_index: usize,
},
UnencodableValue {
input_index: usize,
},
InvalidInputIndex {
index: usize,
len: usize,
},
InvalidOutputIndex {
index: usize,
len: usize,
},
InsufficientOutput {
output_index: usize,
required: usize,
available: usize,
},
OutputLengthOverflow,
}Expand description
Error reported by codec-backed buffered encoder adapters.
The wrapped codec remains responsible for domain-specific encode failures. This type adds adapter-level failures that cannot be represented by the wrapped codec itself, such as a buffered encoder receiving an invalid input or output start index.
Variants§
Encode
The wrapped codec reported an encode error.
Fields
source: EError returned by the wrapped codec.
UnencodableValue
The wrapped codec cannot represent the input value.
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 output required by the adapter call.
Fields
OutputLengthOverflow
Output length arithmetic overflowed while planning encoded output.
Implementations§
Source§impl<E> CodecEncodeError<E>
impl<E> CodecEncodeError<E>
Sourcepub const fn unencodable_value(input_index: usize) -> Self
pub const fn unencodable_value(input_index: usize) -> Self
Sourcepub const fn invalid_input_index(index: usize, len: usize) -> Self
pub const fn invalid_input_index(index: usize, len: usize) -> Self
Sourcepub const fn invalid_output_index(index: usize, len: usize) -> Self
pub const fn invalid_output_index(index: usize, len: usize) -> Self
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
Sourcepub const fn output_length_overflow() -> Self
pub const fn output_length_overflow() -> Self
Sourcepub fn ensure_output_capacity(
output_len: usize,
output_index: usize,
required: usize,
) -> Result<(), Self>
pub fn ensure_output_capacity( output_len: usize, output_index: usize, required: usize, ) -> Result<(), Self>
Validates that an output slice can hold required adapter output.
§Parameters
output_len: Length of the output slice.output_index: Output index supplied by the caller.required: Output units required fromoutput_index.
§Returns
Returns Ok(()) when output capacity is sufficient.
§Errors
Returns an invalid-output-index error when output_index is beyond the
slice, or an insufficient-output error when fewer than required units
are writable from output_index.
Trait Implementations§
Source§impl<E: Clone> Clone for CodecEncodeError<E>
impl<E: Clone> Clone for CodecEncodeError<E>
Source§fn clone(&self) -> CodecEncodeError<E>
fn clone(&self) -> CodecEncodeError<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 CodecEncodeError<E>
Source§impl<E: Debug> Debug for CodecEncodeError<E>
impl<E: Debug> Debug for CodecEncodeError<E>
Source§impl<E> Display for CodecEncodeError<E>where
E: Display,
impl<E> Display for CodecEncodeError<E>where
E: Display,
impl<E: Eq> Eq for CodecEncodeError<E>
Source§impl<E> Error for CodecEncodeError<E>
impl<E> Error for CodecEncodeError<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: Hash> Hash for CodecEncodeError<E>
impl<E: Hash> Hash for CodecEncodeError<E>
Source§impl<E: PartialEq> PartialEq for CodecEncodeError<E>
impl<E: PartialEq> PartialEq for CodecEncodeError<E>
Source§fn eq(&self, other: &CodecEncodeError<E>) -> bool
fn eq(&self, other: &CodecEncodeError<E>) -> bool
self and other values to be equal, and is used by ==.