pub enum CharsetEncodeErrorKind {
InvalidCodePoint {
value: u32,
},
InvalidInputIndex {
input_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.
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.
Trait Implementations§
Source§impl Clone for CharsetEncodeErrorKind
impl Clone for CharsetEncodeErrorKind
Source§fn clone(&self) -> CharsetEncodeErrorKind
fn clone(&self) -> CharsetEncodeErrorKind
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CharsetEncodeErrorKind
impl Debug for CharsetEncodeErrorKind
Source§impl Display for CharsetEncodeErrorKind
impl Display 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)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
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
Tests for
self and other values to be equal, and is used by ==.impl Copy for CharsetEncodeErrorKind
impl Eq for CharsetEncodeErrorKind
impl StructuralPartialEq for CharsetEncodeErrorKind
Auto Trait Implementations§
impl Freeze for CharsetEncodeErrorKind
impl RefUnwindSafe for CharsetEncodeErrorKind
impl Send for CharsetEncodeErrorKind
impl Sync for CharsetEncodeErrorKind
impl Unpin for CharsetEncodeErrorKind
impl UnsafeUnpin for CharsetEncodeErrorKind
impl UnwindSafe for CharsetEncodeErrorKind
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more