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

Trait Implementations

impl Deref<ValueData> for Value

fn deref<'a>(&'a self) -> &'a ValueData

impl Show for Value

fn fmt(&self, f: &mut Formatter) -> Result

impl PartialEq for Value

fn eq(&self, other: &Value) -> bool

fn ne(&self, other: &Self) -> bool

impl ToJson for Value

fn to_json(&self) -> Json

impl Add<Value, Value> for Value

fn add(&self, other: &Value) -> Value

impl Sub<Value, Value> for Value

fn sub(&self, other: &Value) -> Value

impl Mul<Value, Value> for Value

fn mul(&self, other: &Value) -> Value

impl Div<Value, Value> for Value

fn div(&self, other: &Value) -> Value

impl Rem<Value, Value> for Value

fn rem(&self, other: &Value) -> Value

impl BitAnd<Value, Value> for Value

fn bitand(&self, other: &Value) -> Value

impl BitOr<Value, Value> for Value

fn bitor(&self, other: &Value) -> Value

impl BitXor<Value, Value> for Value

fn bitxor(&self, other: &Value) -> Value

impl Shl<Value, Value> for Value

fn shl(&self, other: &Value) -> Value

impl Shr<Value, Value> for Value

fn shr(&self, other: &Value) -> Value

impl Not<Value> for Value

fn not(&self) -> Value

impl Neg<Value> for Value

fn neg(&self) -> Value

impl PartialOrd for Value

fn lt(&self, other: &Value) -> bool

fn le(&self, other: &Value) -> bool

fn gt(&self, other: &Value) -> bool

fn ge(&self, other: &Value) -> bool

impl ToValue for Value

fn to_value(&self) -> Value

impl FromValue for Value

fn from_value(v: Value) -> Result<Value, &'static str>

Derived Implementations

impl Clone for Value

fn clone(&self) -> Value

fn clone_from(&mut self, source: &Self)