pub struct FourByteSequence { /* private fields */ }Expand description
Four-byte UTF-8 sequence
Implementations§
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.