Struct chakracore::value::String
[−]
[src]
pub struct String(_);
A JavaScript string.
Methods
impl String
[src]
fn new(_guard: &ContextGuard, string: &str) -> Self
Creates a string value from a native string.
fn len(&self) -> usize
Returns the length of the string.
fn value(&self) -> String
Converts a JavaScript string to a native string.
fn is_same(value: &Value) -> bool
Returns true if the value is a String
.
impl String
[src]
unsafe fn from_raw(value: JsRef) -> String
Creates an instance from a raw pointer.
This is used for managing the lifetime of JSRT objects. They are
tracked using reference counting; incrementing with from_raw
,
and decrementing with drop
.
This is required to support items stored on the heap, since the JSRT runtime only observes the stack.
If used in conjunction with a Property
or any Value
, it is
assumed a Context
is active.
fn as_raw(&self) -> JsRef
Returns the underlying raw pointer.
Methods from Deref<Target = Value>
fn is_undefined(&self) -> bool
Returns true if this value is undefined
.
fn is_null(&self) -> bool
Returns true if this value is null
.
fn is_number(&self) -> bool
Returns true if this value is a Number
.
fn into_number(self) -> Option<Number>
Represent the value as a Number
. Does not affect the underlying value.
fn is_string(&self) -> bool
Returns true if this value is a String
.
fn into_string(self) -> Option<String>
Represent the value as a String
. Does not affect the underlying value.
fn is_boolean(&self) -> bool
Returns true if this value is a Boolean
.
fn into_boolean(self) -> Option<Boolean>
Represent the value as a Boolean
. Does not affect the underlying value.
fn is_object(&self) -> bool
Returns true if this value is an Object
.
fn into_object(self) -> Option<Object>
Represent the value as an Object
. Does not affect the underlying value.
fn is_external(&self) -> bool
Returns true if this value is an External
.
fn into_external(self) -> Option<External>
Represent the value as an External
. Does not affect the underlying value.
fn is_function(&self) -> bool
Returns true if this value is a Function
.
fn into_function(self) -> Option<Function>
Represent the value as a Function
. Does not affect the underlying value.
fn is_array(&self) -> bool
Returns true if this value is an Array
.
fn into_array(self) -> Option<Array>
Represent the value as an Array
. Does not affect the underlying value.
fn is_array_buffer(&self) -> bool
Returns true if this value is an ArrayBuffer
.
fn into_array_buffer(self) -> Option<ArrayBuffer>
Represent the value as an ArrayBuffer
. Does not affect the underlying value.
fn is_promise(&self) -> bool
Returns true if this value is a Promise
.
fn into_promise(self) -> Option<Promise>
Represent the value as a Promise
. Does not affect the underlying value.
fn to_string(&self, _guard: &ContextGuard) -> String
Converts the value to a native string, containing the value's string representation.
fn to_integer(&self, _guard: &ContextGuard) -> i32
Converts the value to a native integer, containing the value's integer representation.
fn to_double(&self, _guard: &ContextGuard) -> f64
Converts the value to a native double, containing the value's floating point representation.
fn to_bool(&self, _guard: &ContextGuard) -> bool
Converts the value to a native boolean, containing the value's bool representation.
fn to_json(&self, guard: &ContextGuard) -> Result<String>
Converts the value to a native string, containing the value's JSON representation.
fn boolean_representation(&self, _guard: &ContextGuard) -> Boolean
Creates a new boolean with this value represented as Boolean
.
fn number_representation(&self, _guard: &ContextGuard) -> Number
Creates a new number with this value represented as Number
.
fn object_representation(&self, _guard: &ContextGuard) -> Object
Creates a new object with this value represented as Object
.
fn string_representation(&self, _guard: &ContextGuard) -> String
Creates a new string with this value represented as String
.
fn get_type(&self) -> JsValueType
Returns the type of the value. This method should be used with
consideration. It does not keep track of custom types, such as
External
. It only returns the runtime's definition of a type.
fn equals(&self, _guard: &ContextGuard, that: &Value) -> bool
Compare two values for equality (==
).
fn strict_equals(&self, _guard: &ContextGuard, that: &Value) -> bool
Compare two values for strict equality (===
).
Trait Implementations
impl Clone for String
[src]
fn clone(&self) -> String
Duplicates a reference counted type.
The underlying pointer will be copied, and its reference count will be incremented, returned wrapped as the type.
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl Drop for String
[src]
fn drop(&mut self)
Decrements the reference counter if the object is recyclable.