pub enum CodePoint {
Unicode(char),
UnpairedSurrogate(u16),
}Expand description
Represents a Unicode codepoint within a crate::JsString, which could be a valid
‘Unicode scalar value’, or an unpaired surrogate.
Variants§
Implementations§
Source§impl CodePoint
impl CodePoint
Sourcepub const fn code_unit_count(self) -> usize
pub const fn code_unit_count(self) -> usize
Get the number of UTF-16 code units needed to encode this code point.
Sourcepub fn encode_utf16(self, dst: &mut [u16]) -> &mut [u16]
pub fn encode_utf16(self, dst: &mut [u16]) -> &mut [u16]
Encodes this code point as UTF-16 into the provided u16 buffer, and then returns the subslice of the buffer that contains the encoded character.
§Panics
Panics if the buffer is not large enough. A buffer of length 2 is large enough to encode any code point.
Trait Implementations§
impl Copy for CodePoint
impl Eq for CodePoint
impl StructuralPartialEq for CodePoint
Auto Trait Implementations§
impl Freeze for CodePoint
impl RefUnwindSafe for CodePoint
impl Send for CodePoint
impl Sync for CodePoint
impl Unpin for CodePoint
impl UnsafeUnpin for CodePoint
impl UnwindSafe for CodePoint
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