[][src]Enum ducc::Value

pub enum Value<'ducc> {
    Undefined,
    Null,
    Boolean(bool),
    Number(f64),
    String(String<'ducc>),
    Function(Function<'ducc>),
    Array(Array<'ducc>),
    Object(Object<'ducc>),
    Bytes(Bytes<'ducc>),
}

A single JavaScript value.

It is a logic error to share a Value with an internal reference to its parent Ducc between two separate Duccs and doing so will result in a panic.

Variants

Undefined

The JavaScript value undefined.

Null

The JavaScript value null.

Boolean(bool)

The JavaScript value true or false.

Number(f64)

A JavaScript floating point number.

String(String<'ducc>)

An interned JavaScript string, managed by Duktape. Contains an internal reference to its parent Ducc.

Function(Function<'ducc>)

Reference to a JavaScript function. Contains an internal reference to its parent Ducc.

Array(Array<'ducc>)

Reference to a JavaScript array. Contains an internal reference to its parent Ducc.

Object(Object<'ducc>)

Reference to a JavaScript object (guaranteed to not be an array or function). Contains an internal reference to its parent Ducc.

Bytes(Bytes<'ducc>)

Reference to a JavaScript Uint8Array. Contains an internal reference to its parent Ducc.

Methods

impl<'ducc> Value<'ducc>[src]

pub fn is_undefined(&self) -> bool[src]

Returns true if this is a Value::Undefined, false otherwise.

pub fn is_null(&self) -> bool[src]

Returns true if this is a Value::Null, false otherwise.

pub fn is_boolean(&self) -> bool[src]

Returns true if this is a Value::Boolean, false otherwise.

pub fn is_number(&self) -> bool[src]

Returns true if this is a Value::Number, false otherwise.

pub fn is_string(&self) -> bool[src]

Returns true if this is a Value::String, false otherwise.

pub fn is_function(&self) -> bool[src]

Returns true if this is a Value::Function, false otherwise.

pub fn is_array(&self) -> bool[src]

Returns true if this is a Value::Array, false otherwise.

pub fn is_object(&self) -> bool[src]

Returns true if this is a Value::Object, false otherwise.

pub fn is_bytes(&self) -> bool[src]

Returns true if this is a Value::Bytes, false otherwise.

pub fn as_undefined(&self) -> Option<()>[src]

Returns Some(()) if this is a Value::Undefined, None otherwise.

pub fn as_null(&self) -> Option<()>[src]

Returns Some(()) if this is a Value::Null, None otherwise.

pub fn as_boolean(&self) -> Option<bool>[src]

Returns Some if this is a Value::Boolean, None otherwise.

pub fn as_number(&self) -> Option<f64>[src]

Returns Some if this is a Value::Number, None otherwise.

pub fn as_string(&self) -> Option<&String<'ducc>>[src]

Returns Some if this is a Value::String, None otherwise.

pub fn as_function(&self) -> Option<&Function<'ducc>>[src]

Returns Some if this is a Value::Function, None otherwise.

pub fn as_array(&self) -> Option<&Array<'ducc>>[src]

Returns Some if this is a Value::Array, None otherwise.

pub fn as_object(&self) -> Option<&Object<'ducc>>[src]

Returns Some if this is a Value::Object, None otherwise.

pub fn as_bytes(&self) -> Option<&Bytes<'ducc>>[src]

Returns Some if this is a Value::Bytes, None otherwise.

pub fn into<T: FromValue<'ducc>>(self, ducc: &'ducc Ducc) -> Result<T>[src]

A wrapper around FromValue::from_value.

Trait Implementations

impl<'ducc> ToValue<'ducc> for Value<'ducc>[src]

impl<'ducc> FromValue<'ducc> for Value<'ducc>[src]

impl<'ducc> Clone for Value<'ducc>[src]

impl<'ducc> Debug for Value<'ducc>[src]

impl<'ducc> FromIterator<Value<'ducc>> for Values<'ducc>[src]

Auto Trait Implementations

impl<'ducc> !Send for Value<'ducc>

impl<'ducc> Unpin for Value<'ducc>

impl<'ducc> !Sync for Value<'ducc>

impl<'ducc> RefUnwindSafe for Value<'ducc>

impl<'ducc> UnwindSafe for Value<'ducc>

Blanket Implementations

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> From<T> for T[src]

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.

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

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

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