pub struct JsString(/* private fields */);Expand description
JavaScript strings are UTF-16 sequences, including unpaired surrogates. Keep a scalar view only when it exists; equality, hashing and ordering use the original code units, never a replacement-character projection.
Implementations§
Source§impl JsString
impl JsString
pub fn from_units(units: Vec<u16>) -> Self
pub fn units(&self) -> &[u16]
pub fn surround(prefix: &str, value: &Self, suffix: &str) -> Self
pub fn as_str(&self) -> Option<&str>
pub fn is_empty(&self) -> bool
pub fn is_blank(&self) -> bool
Sourcepub fn concat(parts: &[&Self], separator: &str) -> Self
pub fn concat(parts: &[&Self], separator: &str) -> Self
Concatenate without projecting unpaired units into a scalar string.
pub fn starts_with(&self, prefix: &str) -> bool
Sourcepub fn normalized_class(&self) -> Self
pub fn normalized_class(&self) -> Self
ECMAScript trim followed by Unicode default uppercase mapping. Surrogate code units remain unchanged and valid pairs are mapped as one scalar. Host comparisons may supply scoped mappings for their Unicode version.
pub fn write_json(&self, out: &mut String)
Trait Implementations§
Source§impl<'de> Deserialize<'de> for JsString
impl<'de> Deserialize<'de> for JsString
Source§fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
Source§impl Ord for JsString
impl Ord for JsString
Source§impl PartialOrd for JsString
impl PartialOrd for JsString
impl Eq for JsString
Auto Trait Implementations§
impl Freeze for JsString
impl RefUnwindSafe for JsString
impl Send for JsString
impl Sync for JsString
impl Unpin for JsString
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