pub enum CodeUnits {
Bytes(Rc<[u8]>),
Utf16(Rc<[u16]>),
}Expand description
code units of the css source: the bytes of an ascii input, the utf-16 code units otherwise. shared (reference counted): the tokenizer, the string table and the sources reference the same buffer
Variants§
Implementations§
Source§impl CodeUnits
impl CodeUnits
Sourcepub fn from_str(text: &str) -> Self
pub fn from_str(text: &str) -> Self
code units of a string: the bytes when the string is ascii, the utf-16 code units otherwise
Sourcepub fn from_utf16(units: &[u16]) -> Self
pub fn from_utf16(units: &[u16]) -> Self
code units of utf-16 code units: bytes when every unit is ascii
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Sourcepub fn at(&self, index: usize) -> u32
pub fn at(&self, index: usize) -> u32
code unit at an index (codes[i]). out of range reads return 0xffffffff (undefined in typescript)
Sourcepub fn slice(&self, start: usize, end: usize) -> Cow<'_, str>
pub fn slice(&self, start: usize, end: usize) -> Cow<'_, str>
the text of a range. ascii ranges are borrowed: no copy
pub fn hash_range(&self, start: usize, end: usize) -> i32
pub fn hash_range_lower(&self, start: usize, end: usize) -> i32
Trait Implementations§
Auto Trait Implementations§
impl !Send for CodeUnits
impl !Sync for CodeUnits
impl Forget for CodeUnits
impl Freeze for CodeUnits
impl Move for CodeUnits
impl RefUnwindSafe for CodeUnits
impl Unpin for CodeUnits
impl UnsafeUnpin for CodeUnits
impl UnwindSafe for CodeUnits
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