[−][src]Enum boa::js::value::ValueData
A Javascript value
Variants
Null
null
- A null value, for when a value doesn't exist
Undefined
undefined
- An undefined value, for when a field or index doesn't exist
Boolean(bool)
boolean
- A true
/ false
value, for if a certain criteria is met
String(String)
String
- A UTF-8 string, such as "Hello, world"
Number(f64)
Number
- A 64-bit floating point number, such as 3.1415
Integer(i32)
Number
- A 32-bit integer, such as 42
Object(GcCell<ObjectData>, GcCell<ObjectData>)
Object
- An object, such as Math
, represented by a binary tree of string keys to Javascript values
Some Objects will need an internal slot to hold private values, so our second ObjectData is for that
The second object storage is optional for now
Function(GcCell<Function>)
Function
- A runnable block of code, such as Math.sqrt
, which can take some variables and return a useful value or act upon an object
Methods
impl ValueData
[src]
pub fn new_obj(global: Option<&Value>) -> Value
[src]
Returns a new empty object
pub fn new_obj_from_prototype(proto: Value) -> Value
[src]
Similar to new_obj
, but you can pass a prototype to create from
pub fn is_extensible(&self) -> bool
[src]
This will tell us if we can exten an object or not, not properly implemented yet, for now always returns true For scalar types it should be false, for objects check the private field for extensibilaty. By default true https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/seal would turn extensible to false https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze would also turn extensible to false
pub fn is_object(&self) -> bool
[src]
Returns true if the value is an object
pub fn is_function(&self) -> bool
[src]
Returns true if the value is a function
pub fn is_undefined(&self) -> bool
[src]
Returns true if the value is undefined
pub fn is_null(&self) -> bool
[src]
Returns true if the value is null
pub fn is_null_or_undefined(&self) -> bool
[src]
Returns true if the value is null or undefined
pub fn is_double(&self) -> bool
[src]
Returns true if the value is a 64-bit floating-point number
pub fn is_string(&self) -> bool
[src]
Returns true if the value is a string
pub fn is_true(&self) -> bool
[src]
Returns true if the value is true toBoolean
pub fn to_num(&self) -> f64
[src]
Converts the value into a 64-bit floating point number
pub fn to_int(&self) -> i32
[src]
Converts the value into a 32-bit integer
pub fn remove_prop(&self, field: &String)
[src]
remove_prop removes a property from a Value object. It will return a boolean based on if the value was removed, if there was no value to remove false is returned
pub fn get_prop(&self, field: String) -> Option<Property>
[src]
Resolve the property in the object Returns a copy of the Property
pub fn update_prop(
&self,
field: String,
value: Option<Value>,
enumerable: Option<bool>,
writable: Option<bool>,
configurable: Option<bool>
)
[src]
&self,
field: String,
value: Option<Value>,
enumerable: Option<bool>,
writable: Option<bool>,
configurable: Option<bool>
)
update_prop will overwrite individual Property fields, unlike Set_prop, which will overwrite prop with a new Property Mostly used internally for now
pub fn get_private_prop(&self, field: String) -> Option<Property>
[src]
Resolve the property in the object Returns a copy of the Property
pub fn get_private_field(&self, field: String) -> Value
[src]
Resolve the property in the object and get its value, or undefined if this is not an object or the field doesn't exist get_field recieves a Property from get_prop(). It should then return the [[Get]] result value if that's set, otherwise fall back to [Value]
pub fn get_field(&self, field: String) -> Value
[src]
Resolve the property in the object and get its value, or undefined if this is not an object or the field doesn't exist get_field recieves a Property from get_prop(). It should then return the [[Get]] result value if that's set, otherwise fall back to [Value]
pub fn has_field(&self, field: String) -> bool
[src]
Check to see if the Value has the field, mainly used by environment records
pub fn get_field_slice<'a>(&self, field: &'a str) -> Value
[src]
Resolve the property in the object and get its value, or undefined if this is not an object or the field doesn't exist
pub fn set_field(&self, field: String, val: Value) -> Value
[src]
Set the field in the value
pub fn set_field_slice<'a>(&self, field: &'a str, val: Value) -> Value
[src]
Set the field in the value
pub fn set_private_field(&self, field: String, val: Value) -> Value
[src]
Set the private field in the value
pub fn set_private_field_slice<'a>(&self, field: &'a str, val: Value) -> Value
[src]
Set the private field in the value
pub fn set_prop(&self, field: String, prop: Property) -> Property
[src]
Set the property in the value
pub fn set_prop_slice<'t>(&self, field: &'t str, prop: Property) -> Property
[src]
Set the property in the value
pub fn from_json(json: JSONValue) -> ValueData
[src]
Convert from a JSON value to a JS value
pub fn to_json(&self) -> JSONValue
[src]
pub fn get_type(&self) -> &'static str
[src]
Get the type of the value
Trait Implementations
impl PartialEq<ValueData> for ValueData
[src]
fn eq(&self, other: &ValueData) -> bool
[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl Drop for ValueData
[src]
impl Clone for ValueData
[src]
fn clone(&self) -> ValueData
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Debug for ValueData
[src]
impl Display for ValueData
[src]
impl Sub<ValueData> for ValueData
[src]
type Output = ValueData
The resulting type after applying the -
operator.
fn sub(self, other: ValueData) -> ValueData
[src]
impl Add<ValueData> for ValueData
[src]
type Output = ValueData
The resulting type after applying the +
operator.
fn add(self, other: ValueData) -> ValueData
[src]
impl Mul<ValueData> for ValueData
[src]
type Output = ValueData
The resulting type after applying the *
operator.
fn mul(self, other: ValueData) -> ValueData
[src]
impl Div<ValueData> for ValueData
[src]
type Output = ValueData
The resulting type after applying the /
operator.
fn div(self, other: ValueData) -> ValueData
[src]
impl Rem<ValueData> for ValueData
[src]
type Output = ValueData
The resulting type after applying the %
operator.
fn rem(self, other: ValueData) -> ValueData
[src]
impl Not for ValueData
[src]
type Output = ValueData
The resulting type after applying the !
operator.
fn not(self) -> ValueData
[src]
impl BitAnd<ValueData> for ValueData
[src]
type Output = ValueData
The resulting type after applying the &
operator.
fn bitand(self, other: ValueData) -> ValueData
[src]
impl BitOr<ValueData> for ValueData
[src]
type Output = ValueData
The resulting type after applying the |
operator.
fn bitor(self, other: ValueData) -> ValueData
[src]
impl BitXor<ValueData> for ValueData
[src]
type Output = ValueData
The resulting type after applying the ^
operator.
fn bitxor(self, other: ValueData) -> ValueData
[src]
impl Shl<ValueData> for ValueData
[src]
type Output = ValueData
The resulting type after applying the <<
operator.
fn shl(self, other: ValueData) -> ValueData
[src]
impl Shr<ValueData> for ValueData
[src]
type Output = ValueData
The resulting type after applying the >>
operator.
fn shr(self, other: ValueData) -> ValueData
[src]
impl Finalize for ValueData
[src]
impl Trace for ValueData
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T, Rhs, Output> NumOps<Rhs, Output> for T where
T: Sub<Rhs, Output = Output> + Mul<Rhs, Output = Output> + Div<Rhs, Output = Output> + Add<Rhs, Output = Output> + Rem<Rhs, Output = Output>,
[src]
T: Sub<Rhs, Output = Output> + Mul<Rhs, Output = Output> + Div<Rhs, Output = Output> + Add<Rhs, Output = Output> + Rem<Rhs, Output = Output>,