pub enum CodecEncodeError<E> {
Encode {
source: E,
input_index: usize,
},
EncodeReset {
source: E,
},
EncodeFlush {
source: E,
},
UnencodableValue {
input_index: usize,
},
}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 domain failures that cannot be represented by
the wrapped codec itself, such as a value outside the codec’s encodable
domain. Buffer index and capacity failures are represented by
crate::TranscodeError.
Variants§
Encode
The wrapped codec reported an encode error.
Fields
source: EError returned by the wrapped codec.
EncodeReset
The wrapped codec reported an error while resetting encode state.
Fields
source: EError returned by crate::Codec::encode_reset.
EncodeFlush
The wrapped codec reported an error while flushing encode state.
Fields
source: EError returned by crate::Codec::encode_flush.
UnencodableValue
The wrapped codec cannot represent the input value.
Implementations§
Source§impl<E> CodecEncodeError<E>
impl<E> CodecEncodeError<E>
Sourcepub const fn encode_reset(source: E) -> Self
pub const fn encode_reset(source: E) -> Self
Creates an error wrapping a codec-specific encode-reset error.
§Parameters
source: Error returned bycrate::Codec::encode_reset.
§Returns
Returns a codec encode-reset error wrapper.
Sourcepub const fn encode_flush(source: E) -> Self
pub const fn encode_flush(source: E) -> Self
Creates an error wrapping a codec-specific encode-flush error.
§Parameters
source: Error returned bycrate::Codec::encode_flush.
§Returns
Returns a codec encode-flush error wrapper.
Sourcepub const fn unencodable_value(input_index: usize) -> Self
pub const fn unencodable_value(input_index: usize) -> Self
Sourcepub fn into_source(self) -> Option<E>
pub fn into_source(self) -> Option<E>
Extracts the wrapped codec source error, when this variant has one.
§Returns
Returns Some(source) for codec encode, reset, and flush failures.
Returns None for adapter-only failures.
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 ==.