#[repr(C)]pub struct FourByteSequence {
first: LeadForFourByte,
second: UnconstrainedContinuation,
third: UnconstrainedContinuation,
fourth: UnconstrainedContinuation,
}Expand description
Four-byte UTF-8 sequence
Fields§
§first: LeadForFourByte§second: UnconstrainedContinuation§Safety invariant
second must be in the correct range given the value of
first so that first, second, third, and fourth
form a well-formed UTF-8 sequence.
third: UnconstrainedContinuation§fourth: UnconstrainedContinuationImplementations§
Source§impl FourByteSequence
impl FourByteSequence
Sourcepub const fn is_with_prepared(prepared: PreparedThreeBytes, fourth: u8) -> bool
pub const fn is_with_prepared(prepared: PreparedThreeBytes, fourth: u8) -> bool
Whether prepared and fourth form a well-formed four-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, fourth: u8) -> bool
pub const fn is(first: u8, second: u8, third: u8, fourth: u8) -> bool
Whether the bytes form a well-formed four-byte UTF-8 sequence.
§Safety-usable invariant
Iff this method returns true, the safety invariant of new_unchecked()
is satisfied.
Sourcepub const fn try_new(
first: u8,
second: u8,
third: u8,
fourth: u8,
) -> Result<Self, Utf8ByteError>
pub const fn try_new( first: u8, second: u8, third: u8, fourth: u8, ) -> Result<Self, Utf8ByteError>
Fallible constructor
Ok if first, second, third, and fourth form a four-byte UTF-8 sequence and Err otherwise.
Sourcepub const fn try_new_with_prepared(
prepared: PreparedThreeBytes,
fourth: u8,
) -> Result<Self, Utf8ByteError>
pub const fn try_new_with_prepared( prepared: PreparedThreeBytes, fourth: u8, ) -> Result<Self, Utf8ByteError>
Fallible constructor with prepared bytes
Ok if the prepared bytes and fourth form a four-byte UTF-8 sequence and Err otherwise.
Sourcepub const fn to_typed_bytes(
self,
) -> (LeadForFourByte, UnconstrainedContinuation, UnconstrainedContinuation, UnconstrainedContinuation)
pub const fn to_typed_bytes( self, ) -> (LeadForFourByte, UnconstrainedContinuation, UnconstrainedContinuation, UnconstrainedContinuation)
Convert to typed byte tuple.
§Safety-usable invariant
The tuple represents a well-formed four-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 FourByteSequence
impl AsRef<str> for FourByteSequence
Source§impl Clone for FourByteSequence
impl Clone for FourByteSequence
Source§fn clone(&self) -> FourByteSequence
fn clone(&self) -> FourByteSequence
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more