Struct rusty_v8::String [−][src]
#[repr(C)]pub struct String(_);
Expand description
A JavaScript string value (ECMA-262, 4.3.17).
Implementations
pub fn new_from_utf8<'s>(
scope: &mut HandleScope<'s, ()>,
buffer: &[u8],
new_type: NewStringType
) -> Option<Local<'s, String>>
pub fn new_from_utf8<'s>(
scope: &mut HandleScope<'s, ()>,
buffer: &[u8],
new_type: NewStringType
) -> Option<Local<'s, String>>
Allocates a new string from UTF-8 data. Only returns an empty value when length > kMaxLength
pub fn new_from_one_byte<'s>(
scope: &mut HandleScope<'s, ()>,
buffer: &[u8],
new_type: NewStringType
) -> Option<Local<'s, String>>
pub fn new_from_one_byte<'s>(
scope: &mut HandleScope<'s, ()>,
buffer: &[u8],
new_type: NewStringType
) -> Option<Local<'s, String>>
Allocates a new string from Latin-1 data. Only returns an empty value when length > kMaxLength.
pub fn new_from_two_byte<'s>(
scope: &mut HandleScope<'s, ()>,
buffer: &[u16],
new_type: NewStringType
) -> Option<Local<'s, String>>
pub fn new_from_two_byte<'s>(
scope: &mut HandleScope<'s, ()>,
buffer: &[u16],
new_type: NewStringType
) -> Option<Local<'s, String>>
Allocates a new string from UTF-16 data. Only returns an empty value when length > kMaxLength.
Returns the number of characters (UTF-16 code units) in this string.
Returns the number of bytes in the UTF-8 encoded representation of this string.
Writes the contents of the string to an external buffer, as 16-bit (UTF-16) character codes.
pub fn write_one_byte(
&self,
scope: &mut Isolate,
buffer: &mut [u8],
start: usize,
options: WriteOptions
) -> usize
pub fn write_one_byte(
&self,
scope: &mut Isolate,
buffer: &mut [u8],
start: usize,
options: WriteOptions
) -> usize
Writes the contents of the string to an external buffer, as one-byte (Latin-1) characters.
pub fn write_utf8(
&self,
scope: &mut Isolate,
buffer: &mut [u8],
nchars_ref: Option<&mut usize>,
options: WriteOptions
) -> usize
pub fn write_utf8(
&self,
scope: &mut Isolate,
buffer: &mut [u8],
nchars_ref: Option<&mut usize>,
options: WriteOptions
) -> usize
Writes the contents of the string to an external buffer, as UTF-8.
pub fn new_external_onebyte_static<'s>(
scope: &mut HandleScope<'s, ()>,
buffer: &'static [u8]
) -> Option<Local<'s, String>>
pub fn new_external_twobyte_static<'s>(
scope: &mut HandleScope<'s, ()>,
buffer: &'static [u16]
) -> Option<Local<'s, String>>
True if string is external
True if string is external & one-byte (e.g: created with new_external_onebyte_static)
True if string is external & two-byte (e.g: created with new_external_twobyte_static)
True if string is known to contain only one-byte data. Doesn’t read the string so can return false positives.
For a method that will not return false positives at the cost of
potentially reading the entire string, use contains_only_onebyte()
.
True if the string contains only one-byte data. Will read the entire string in some cases.
Convenience function not present in the original V8 API.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for String
impl UnwindSafe for String