Struct js::front::stdlib::value::Value[src]
pub struct Value {
pub ptr: Gc<ValueData>,
}A Garbage-collected Javascript value as represented in the interpreter
Fields
ptr | The garbage-collected pointer |
Methods
impl Value
fn new(data: ValueData) -> Value
Move some value data into a new value
fn new_global() -> Value
Create a new global object
fn new_obj(global: Option<Value>) -> Value
Returns a new empty object
fn is_object(&self) -> bool
Returns true if the value is an object
fn is_undefined(&self) -> bool
Returns true if the value is undefined
fn is_null(&self) -> bool
Returns true if the value is null
fn is_null_or_undefined(&self) -> bool
Returns true if the value is null or undefined
fn is_double(&self) -> bool
Returns true if the value is a 64-bit floating-point number
fn is_string(&self) -> bool
Returns true if the value is a string
fn is_true(&self) -> bool
Returns true if the value is true
fn to_num(&self) -> f64
Converts the value into a 64-bit floating point number
fn to_int(&self) -> i32
Converts the value into a 32-bit integer
fn get_prop<'a>(&self, field: &'a str) -> Option<Property>
Resolve the property in the object
fn get_field<'a>(&self, field: &'a str) -> Value
Resolve the property in the object and get its value, or undefined if this is not an object or the field doesn't exist
fn set_field<'a>(&self, field: &'a str, val: Value) -> Value
Set the field in the value
fn set_prop<'a>(&self, field: &'a str, prop: Property) -> Property
Set the property in the value
fn from_json(json: Json) -> ValueData
Convert from a JSON value to a JS value
fn get_type(&self) -> &'static str
Get the type of the value
fn undefined() -> Value
Get the value for undefined