[][src]Enum duk::Value

pub enum Value {
    Undefined,
    Null,
    Boolean(bool),
    Number(f64),
    String(String),
    Array(Vec<Value>),
    Object(BTreeMap<String, Value>),
    Bytes(Vec<u8>),
    Foreign(&'static str),
}

A Javascript/Ecmascript value that exists in the Rust world.

Duktape supports values beyond these, but they don't have good Rust semantics, so they cannot be interacted with from the Rust world. They are therefore mapped to Value::Foreign when retrieved, and trying to further use those values is generally equivalent to using undefined.

Variants

Undefined

The undefined value.

Null

The null value.

Boolean(bool)

A boolean like true or false.

Number(f64)

Any number (both integral like 5 and fractional like 2.3).

String(String)

Any string like 'abc'.

Array(Vec<Value>)

Any array of values like ['a', 2, false].

A JSON-like object like {a: 'a', b: 2, c: false}.

Bytes(Vec<u8>)

A Duktape byte buffer like Duktape.Buffer('abc').

Foreign(&'static str)

A Duktape value that cannot be represented in Rust (yet).

Contains a &str describing the foreign type.

Methods

impl Value[src]

pub fn to_reference<'a>(&self, context: &'a Context) -> Reference<'a>[src]

Copies this value into a Context, and returns the reference to the value within the context.

Trait Implementations

impl Argument for Value[src]

impl Clone for Value[src]

impl Debug for Value[src]

impl PartialEq<Value> for Value[src]

impl StructuralPartialEq for Value[src]

Auto Trait Implementations

impl RefUnwindSafe for Value

impl Send for Value

impl Sync for Value

impl Unpin for Value

impl UnwindSafe for Value

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.