pub struct TwoByteSequence { /* private fields */ }Expand description
Two-byte UTF-8 sequence
Implementations§
Source§impl TwoByteSequence
impl TwoByteSequence
Sourcepub const fn is_with_prepared(prepared: PreparedTwoBytes) -> bool
pub const fn is_with_prepared(prepared: PreparedTwoBytes) -> bool
Whether prepared forms a well-formed two-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) -> bool
pub const fn is(first: u8, second: u8) -> bool
Checks whether the bytes form a well-formed two-byte UTF-8 sequence.
§Safety-usable invariant
Iff this method returns true, the safety invariant of new_unchecked()
is satisfied.
Sourcepub const fn new(
first: LeadForTwoByte,
second: UnconstrainedContinuation,
) -> Self
pub const fn new( first: LeadForTwoByte, second: UnconstrainedContinuation, ) -> Self
Typed constructor
Sourcepub const unsafe fn new_unchecked(first: u8, second: u8) -> Self
pub const unsafe fn new_unchecked(first: u8, second: u8) -> Self
Sourcepub const fn try_new(first: u8, second: u8) -> Result<Self, Utf8ByteError>
pub const fn try_new(first: u8, second: u8) -> Result<Self, Utf8ByteError>
Fallible constructor
Ok if first and second form a two-byte UTF-8 sequence and Err otherwise.
Sourcepub const fn try_new_with_prepared(
prepared: PreparedTwoBytes,
) -> Result<Self, Utf8ByteError>
pub const fn try_new_with_prepared( prepared: PreparedTwoBytes, ) -> Result<Self, Utf8ByteError>
Fallible constructor with prepared bytes
Ok if the prepared bytes form a two-byte UTF-8 sequence and Err otherwise.
Sourcepub const fn to_typed_bytes(self) -> (LeadForTwoByte, UnconstrainedContinuation)
pub const fn to_typed_bytes(self) -> (LeadForTwoByte, UnconstrainedContinuation)
Convert to typed byte tuple.
Trait Implementations§
Source§impl AsRef<str> for TwoByteSequence
impl AsRef<str> for TwoByteSequence
Source§impl Clone for TwoByteSequence
impl Clone for TwoByteSequence
impl Copy for TwoByteSequence
Source§impl Debug for TwoByteSequence
impl Debug for TwoByteSequence
impl Eq for TwoByteSequence
Source§impl From<TwoByteSequence> for char
impl From<TwoByteSequence> for char
Source§fn from(two_byte: TwoByteSequence) -> Self
fn from(two_byte: TwoByteSequence) -> Self
Converts to this type from the input type.
Source§impl Hash for TwoByteSequence
impl Hash for TwoByteSequence
Source§impl Ord for TwoByteSequence
impl Ord for TwoByteSequence
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 TwoByteSequence
impl PartialEq for TwoByteSequence
Source§impl PartialOrd for TwoByteSequence
impl PartialOrd for TwoByteSequence
impl StructuralPartialEq for TwoByteSequence
impl Utf8ByteSequence for TwoByteSequence
Auto Trait Implementations§
impl Freeze for TwoByteSequence
impl RefUnwindSafe for TwoByteSequence
impl Send for TwoByteSequence
impl Sync for TwoByteSequence
impl Unpin for TwoByteSequence
impl UnsafeUnpin for TwoByteSequence
impl UnwindSafe for TwoByteSequence
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