pub trait U16UtfExt {
// Required methods
fn utf16_needs_extra_unit(self) -> Result<bool, InvalidUtf16FirstUnit>;
fn is_utf16_leading_surrogate(self) -> bool;
}Expand description
Methods for working with u16s as UTF-16 units.
Required Methods§
Sourcefn utf16_needs_extra_unit(self) -> Result<bool, InvalidUtf16FirstUnit>
fn utf16_needs_extra_unit(self) -> Result<bool, InvalidUtf16FirstUnit>
Will you need an extra unit to complete this codepoint?
Returns Err for trailing surrogates, Ok(true) for leading surrogates,
and Ok(false) for others.
Sourcefn is_utf16_leading_surrogate(self) -> bool
fn is_utf16_leading_surrogate(self) -> bool
Does this u16 need another u16 to complete a codepoint?
Returns (self & 0xfc00) == 0xd800
Is basically an unchecked variant of utf16_needs_extra_unit().