pub struct JsString { /* private fields */ }Expand description
An immutable string, stored on the GC heap.
The content is a Wtf8; the wrapper exists so a Value can hold a Gc handle rather
than the bytes.
Implementations§
Source§impl JsString
impl JsString
Sourcepub fn units_cached(&self) -> Rc<Vec<u16>>
pub fn units_cached(&self) -> Rc<Vec<u16>>
The code units, decoding once and remembering the result.
Sourcepub fn code_unit_at(&self, index: usize) -> Option<u16>
pub fn code_unit_at(&self, index: usize) -> Option<u16>
The code unit at index, in O(1) once the cache is warm.
Sourcepub fn to_string_lossy(&self) -> Cow<'_, str>
pub fn to_string_lossy(&self) -> Cow<'_, str>
The text with unpaired surrogates replaced by U+FFFD.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for JsString
impl !RefUnwindSafe for JsString
impl !Send for JsString
impl !Sync for JsString
impl Forget for JsString
impl Move for JsString
impl Unpin for JsString
impl UnsafeUnpin for JsStringwhere
*const [u8] is !null: UnsafeUnpin,
PhantomData<[u8]>: UnsafeUnpin,
*const RcInner<Vec<u16>> is !null: UnsafeUnpin,
PhantomData<RcInner<Vec<u16>>>: UnsafeUnpin,
impl UnwindSafe for JsString
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