Struct rquickjs_core::Atom[][src]

pub struct Atom<'js> { /* fields omitted */ }

An atom is value representing the name of a variable of an objects and can be created from any javascript value.

Representation

Atoms in quickjs are handled differently depending on what type of index the represent. When the atom represents a number like index, like object[1] the atom is just a normal number. However when the atom represents a string link index like object["foo"] or object.foo the atom represents a value in a hashmap.

Implementations

impl<'js> Atom<'js>[src]

pub fn from_value(ctx: Ctx<'js>, val: &Value<'js>) -> Atom<'js>[src]

Create a atom from a javascript value.

pub fn from_u32(ctx: Ctx<'js>, val: u32) -> Atom<'js>[src]

Create a atom from a u32

pub fn from_i32(ctx: Ctx<'js>, val: i32) -> Atom<'js>[src]

Create a atom from an i32 via value

pub fn from_bool(ctx: Ctx<'js>, val: bool) -> Atom<'js>[src]

Create a atom from a bool via value

pub fn from_f64(ctx: Ctx<'js>, val: f64) -> Atom<'js>[src]

Create a atom from a f64 via value

pub fn from_str(ctx: Ctx<'js>, name: &str) -> Atom<'js>[src]

Create a atom from a rust string

pub fn to_string(&self) -> Result<StdString>[src]

Convert the atom to a javascript string.

pub fn to_js_string(&self) -> Result<String<'js>>[src]

Convert the atom to a javascript string .

pub fn to_value(&self) -> Result<Value<'js>>[src]

Convert the atom to a javascript value.

Trait Implementations

impl<'js> Clone for Atom<'js>[src]

impl<'js> Drop for Atom<'js>[src]

impl<'js> FromAtom<'js> for Atom<'js>[src]

impl<'js> IntoAtom<'js> for Atom<'js>[src]

Auto Trait Implementations

impl<'js> !RefUnwindSafe for Atom<'js>[src]

impl<'js> !Send for Atom<'js>[src]

impl<'js> !Sync for Atom<'js>[src]

impl<'js> Unpin for Atom<'js>[src]

impl<'js> UnwindSafe for Atom<'js>[src]

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.