Skip to main content

JsText

Trait JsText 

Source
pub trait JsText<'a> {
    // Required method
    fn text(self) -> Cow<'a, str>;
}
Expand description

The text of a JavaScript string value.

A well-formed value is borrowed. A value with a lone surrogate is owned, with each lone surrogate written as \uXXXX (as JSStr::display does). Oxc 0.152 also stored a lone surrogate as escaped text (\u{FFFD}XXXX), so the text of every well-formed value is the same as before.

Required Methods§

Source

fn text(self) -> Cow<'a, str>

Return the value as UTF-8 text.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<'a> JsText<'a> for JSStr<'a>

Source§

fn text(self) -> Cow<'a, str>

Source§

impl<'b> JsText<'b> for &'b StaticPropertyName<'_>

Source§

fn text(self) -> Cow<'b, str>

Implementors§