pub enum CharsetEncodeErrorKind {
InvalidCodePoint {
value: u32,
},
InvalidInputIndex {
input_len: usize,
},
InvalidOutputIndex {
output_len: usize,
},
UnmappableCharacter {
value: u32,
},
BufferTooSmall {
required: usize,
available: usize,
},
}Expand description
Classifies failures detected while encoding Unicode text into encoded units.
Variants§
InvalidCodePoint
The supplied code point is not a valid Unicode scalar value.
InvalidInputIndex
The requested input character index is outside the input buffer.
InvalidOutputIndex
The requested output unit index is outside the output buffer.
UnmappableCharacter
The character cannot be represented by the target encoding.
BufferTooSmall
The supplied output buffer is too small for the encoded character.
Implementations§
Source§impl CharsetEncodeErrorKind
impl CharsetEncodeErrorKind
Sourcepub const fn value(self) -> Option<u32>
pub const fn value(self) -> Option<u32>
Returns the raw value associated with the error kind, if available.
§Returns
Some(value)forSelf::InvalidCodePointandSelf::UnmappableCharacter;Nonefor other kinds.
Sourcepub const fn required(self) -> Option<usize>
pub const fn required(self) -> Option<usize>
Returns the number of required output units for this kind, if available.
§Returns
Some(required)forSelf::BufferTooSmall;Nonefor all other variants.
Sourcepub const fn available(self) -> Option<usize>
pub const fn available(self) -> Option<usize>
Returns the number of currently available output units for this kind, if available.
§Returns
Some(available)forSelf::BufferTooSmall;Nonefor all other variants.
Sourcepub const fn input_len(self) -> Option<usize>
pub const fn input_len(self) -> Option<usize>
Returns the input length when this error comes from an invalid input index.
§Returns
Some(input_len)forSelf::InvalidInputIndex;Nonefor other variants.
Sourcepub const fn output_len(self) -> Option<usize>
pub const fn output_len(self) -> Option<usize>
Returns the output length when this error comes from an invalid output index.
§Returns
Some(output_len)forSelf::InvalidOutputIndex;Nonefor other variants.
Trait Implementations§
Source§impl Clone for CharsetEncodeErrorKind
impl Clone for CharsetEncodeErrorKind
Source§fn clone(&self) -> CharsetEncodeErrorKind
fn clone(&self) -> CharsetEncodeErrorKind
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 CharsetEncodeErrorKind
Source§impl Debug for CharsetEncodeErrorKind
impl Debug for CharsetEncodeErrorKind
Source§impl Display for CharsetEncodeErrorKind
impl Display for CharsetEncodeErrorKind
impl Eq for CharsetEncodeErrorKind
Source§impl Error for CharsetEncodeErrorKind
impl Error for CharsetEncodeErrorKind
1.30.0 · 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 PartialEq for CharsetEncodeErrorKind
impl PartialEq for CharsetEncodeErrorKind
Source§fn eq(&self, other: &CharsetEncodeErrorKind) -> bool
fn eq(&self, other: &CharsetEncodeErrorKind) -> bool
self and other values to be equal, and is used by ==.