pub struct AsciiCodec;Expand description
Single-byte ASCII codec for bytes.
AsciiCodec converts between one-byte ASCII-encoded data and Unicode scalar
values.
Implementations§
Source§impl AsciiCodec
impl AsciiCodec
Trait Implementations§
Source§impl CharsetCodec for AsciiCodec
impl CharsetCodec for AsciiCodec
Source§fn max_units_per_char(&self) -> usize
fn max_units_per_char(&self) -> usize
Source§fn decode_one(
&self,
input: &[u8],
index: usize,
) -> CharsetDecodeResult<DecodeStatus>
fn decode_one( &self, input: &[u8], index: usize, ) -> CharsetDecodeResult<DecodeStatus>
Decodes one ASCII byte into a char.
§Parameters
input: Complete input byte slice.index: Absolute byte index at which decoding starts.
§Returns
Ok(DecodeStatus::Complete { value, consumed: 1 }) for ASCII bytes.
§Errors
Returns CharsetDecodeErrorKind::MalformedSequence when:
indexis out of range, or- current byte is not in the ASCII range
0x00..=0x7F.
Source§fn encode_one(
&self,
ch: char,
output: &mut [u8],
index: usize,
) -> CharsetEncodeResult<usize>
fn encode_one( &self, ch: char, output: &mut [u8], index: usize, ) -> CharsetEncodeResult<usize>
Encodes one char into one ASCII byte.
§Parameters
ch: The character to encode.output: Output byte slice.index: Absolute output index where writing starts.
§Returns
Ok(1) when one byte is written.
§Errors
CharsetEncodeErrorKind::BufferTooSmallifindex >= output.len().CharsetEncodeErrorKind::UnmappableCharacterifchis not ASCII.
Source§impl Clone for AsciiCodec
impl Clone for AsciiCodec
Source§fn clone(&self) -> AsciiCodec
fn clone(&self) -> AsciiCodec
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 AsciiCodec
impl Debug for AsciiCodec
Source§impl Default for AsciiCodec
impl Default for AsciiCodec
Source§fn default() -> AsciiCodec
fn default() -> AsciiCodec
Returns the “default value” for a type. Read more
Source§impl Hash for AsciiCodec
impl Hash for AsciiCodec
Source§impl PartialEq for AsciiCodec
impl PartialEq for AsciiCodec
Source§fn eq(&self, other: &AsciiCodec) -> bool
fn eq(&self, other: &AsciiCodec) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Copy for AsciiCodec
impl Eq for AsciiCodec
impl StructuralPartialEq for AsciiCodec
Auto Trait Implementations§
impl Freeze for AsciiCodec
impl RefUnwindSafe for AsciiCodec
impl Send for AsciiCodec
impl Sync for AsciiCodec
impl Unpin for AsciiCodec
impl UnsafeUnpin for AsciiCodec
impl UnwindSafe for AsciiCodec
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