[−][src]Enum ducc::Value
A single JavaScript value.
It is a logic error to share a Value
with an internal reference to its parent Ducc
between
two separate Ducc
s and doing so will result in a panic.
Variants
The JavaScript value undefined
.
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]
fn from_value(value: Value<'ducc>, _ducc: &'ducc Ducc) -> Result<Self>
[src]
impl<'ducc> Clone for Value<'ducc>
[src]
impl<'ducc> Debug for Value<'ducc>
[src]
impl<'ducc> FromIterator<Value<'ducc>> for Values<'ducc>
[src]
fn from_iter<I: IntoIterator<Item = Value<'ducc>>>(iter: I) -> Self
[src]
Auto Trait Implementations
impl<'ducc> !Send for Value<'ducc>
impl<'ducc> !Sync for Value<'ducc>
impl<'ducc> Unpin for Value<'ducc>
impl<'ducc> UnwindSafe for Value<'ducc>
impl<'ducc> RefUnwindSafe for Value<'ducc>
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
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> 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> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,