#[repr(C)]pub struct ThreeByteSequence {
first: LeadForThreeByte,
second: UnconstrainedContinuation,
third: UnconstrainedContinuation,
}Expand description
Three-byte UTF-8 sequence
Fields§
§first: LeadForThreeByte§second: UnconstrainedContinuation§Safety invariant
second must be in the correct range given the value of
first so that first, second, and third form a
well-formed UTF-8 sequence.
third: UnconstrainedContinuationImplementations§
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
Source§fn clone(&self) -> ThreeByteSequence
fn clone(&self) -> ThreeByteSequence
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more