pub struct ThreeByteSequence { /* private fields */ }Expand description
Three-byte UTF-8 sequence
Implementations§
Source§impl ThreeByteSequence
impl ThreeByteSequence
Sourcepub const fn is_with_prepared(prepared: PreparedThreeBytes) -> bool
pub const fn is_with_prepared(prepared: PreparedThreeBytes) -> bool
Whether prepared forms a well-formed three-byte UTF-8 sequence.
§Safety-usable invariant
Iff this method returns true, the safety invariant of new_unchecked()
is satisfied.
Sourcepub const fn is(first: u8, second: u8, third: u8) -> bool
pub const fn is(first: u8, second: u8, third: u8) -> bool
Whether the bytes form a well-formed three-byte UTF-8 sequence.
§Safety-usable invariant
Iff this method returns true, the safety invariant of new_unchecked()
is satisfied.
Sourcepub const unsafe fn new_unchecked(first: u8, second: u8, third: u8) -> Self
pub const unsafe fn new_unchecked(first: u8, second: u8, third: u8) -> Self
Sourcepub const fn try_new(
first: u8,
second: u8,
third: u8,
) -> Result<Self, Utf8ByteError>
pub const fn try_new( first: u8, second: u8, third: u8, ) -> Result<Self, Utf8ByteError>
Fallible constructor
Ok if first, second, and third form a three-byte UTF-8 sequence and Err otherwise.
Sourcepub const fn try_new_with_prepared(
prepared: PreparedThreeBytes,
) -> Result<Self, Utf8ByteError>
pub const fn try_new_with_prepared( prepared: PreparedThreeBytes, ) -> Result<Self, Utf8ByteError>
Fallible constructor with prepared bytes
Ok if the prepared bytes form a three-byte UTF-8 sequence and Err otherwise.
Sourcepub const fn to_typed_bytes(
self,
) -> (LeadForThreeByte, UnconstrainedContinuation, UnconstrainedContinuation)
pub const fn to_typed_bytes( self, ) -> (LeadForThreeByte, UnconstrainedContinuation, UnconstrainedContinuation)
Convert to typed byte tuple.
§Safety-usable invariant
The tuple represents a well-formed three-byte UTF-8 sequence. In particular, the value of the second tuple item is within the permissible range given the value of the first tuple item.
Trait Implementations§
Source§impl AsRef<str> for ThreeByteSequence
impl AsRef<str> for ThreeByteSequence
Source§impl Clone for ThreeByteSequence
impl Clone for ThreeByteSequence
impl Copy for ThreeByteSequence
Source§impl Debug for ThreeByteSequence
impl Debug for ThreeByteSequence
impl Eq for ThreeByteSequence
Source§impl From<ThreeByteSequence> for char
impl From<ThreeByteSequence> for char
Source§fn from(three_byte: ThreeByteSequence) -> Self
fn from(three_byte: ThreeByteSequence) -> Self
Converts to this type from the input type.
Source§impl Hash for ThreeByteSequence
impl Hash for ThreeByteSequence
Source§impl Ord for ThreeByteSequence
impl Ord for ThreeByteSequence
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialEq for ThreeByteSequence
impl PartialEq for ThreeByteSequence
Source§impl PartialOrd for ThreeByteSequence
impl PartialOrd for ThreeByteSequence
impl StructuralPartialEq for ThreeByteSequence
impl Utf8ByteSequence for ThreeByteSequence
Auto Trait Implementations§
impl Freeze for ThreeByteSequence
impl RefUnwindSafe for ThreeByteSequence
impl Send for ThreeByteSequence
impl Sync for ThreeByteSequence
impl Unpin for ThreeByteSequence
impl UnsafeUnpin for ThreeByteSequence
impl UnwindSafe for ThreeByteSequence
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