pub struct String<'ducc>(/* private fields */);Expand description
An immutable, interned JavaScript string managed by Duktape.
Unlike Rust strings, Duktape strings are CESU-8 (not UTF-8).
Implementations§
Source§impl<'ducc> String<'ducc>
impl<'ducc> String<'ducc>
Sourcepub fn to_string(&self) -> Result<StdString>
pub fn to_string(&self) -> Result<StdString>
Returns a Rust string converted from the Duktape string as long as it can be converted from CESU-8 to UTF-8.
Sourcepub fn as_bytes(&self) -> &[u8] ⓘ
pub fn as_bytes(&self) -> &[u8] ⓘ
Returns the bytes that make up this string, without a trailing nul byte. This is a CESU-8 string.
Sourcepub fn as_bytes_with_nul(&self) -> &[u8] ⓘ
pub fn as_bytes_with_nul(&self) -> &[u8] ⓘ
Returns the bytes that make up this string, including a trailing nul byte. This is a CESU-8 string.
Trait Implementations§
Auto Trait Implementations§
impl<'ducc> Freeze for String<'ducc>
impl<'ducc> RefUnwindSafe for String<'ducc>
impl<'ducc> !Send for String<'ducc>
impl<'ducc> !Sync for String<'ducc>
impl<'ducc> Unpin for String<'ducc>
impl<'ducc> UnsafeUnpin for String<'ducc>
impl<'ducc> UnwindSafe for String<'ducc>
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