Enum utf8_parser::Utf8ByteType
source · pub enum Utf8ByteType {
Continuation,
Single,
Double,
Triple,
Quadruple,
}
Expand description
Categorization of a valid byte in UTF-8
Example
use utf8_parser::Utf8ByteType;
assert_eq!(Utf8ByteType::of(0b00001100)?, Utf8ByteType::Single);
assert_eq!(Utf8ByteType::of(0b10001100)?, Utf8ByteType::Continuation);
Variants§
Continuation
A continuation byte
Single
A one-byte UTF-8 character, i.e. an ASCII value
Double
A start byte that must be followed by one continuation byte
Triple
A start byte that must be followed by two continuation bytes
Quadruple
A start byte that must be followed by three continuation bytes
Implementations§
source§impl Utf8ByteType
impl Utf8ByteType
sourcepub fn of(byte: u8) -> Result<Self, Utf8ParserError>
pub fn of(byte: u8) -> Result<Self, Utf8ParserError>
Get type of byte
sourcepub const fn is_continuation(self) -> bool
pub const fn is_continuation(self) -> bool
Returns true if this is a continuation byte
Trait Implementations§
source§impl Clone for Utf8ByteType
impl Clone for Utf8ByteType
source§fn clone(&self) -> Utf8ByteType
fn clone(&self) -> Utf8ByteType
Returns a copy of the value. Read more
1.0.0 · 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 Utf8ByteType
impl Debug for Utf8ByteType
source§impl Hash for Utf8ByteType
impl Hash for Utf8ByteType
source§impl PartialEq for Utf8ByteType
impl PartialEq for Utf8ByteType
source§fn eq(&self, other: &Utf8ByteType) -> bool
fn eq(&self, other: &Utf8ByteType) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl Copy for Utf8ByteType
impl Eq for Utf8ByteType
impl StructuralEq for Utf8ByteType
impl StructuralPartialEq for Utf8ByteType
Auto Trait Implementations§
impl RefUnwindSafe for Utf8ByteType
impl Send for Utf8ByteType
impl Sync for Utf8ByteType
impl Unpin for Utf8ByteType
impl UnwindSafe for Utf8ByteType
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