Struct rquickjs_core::Array[][src]

#[repr(transparent)]pub struct Array<'js>(_);

Rust representation of a javascript object optimized as an array.

Javascript array's are objects and can be used as such. However arrays in quickjs are optimized when they do not have any holes. This value represents such a optimized array.

Implementations

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

pub fn new(ctx: Ctx<'js>) -> Result<Self>[src]

pub fn len(&self) -> usize[src]

Get the lenght of the javascript array.

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

Returns wether a javascript array is empty.

pub fn get<V: FromJs<'js>>(&self, idx: usize) -> Result<V>[src]

Get the value at an index in the javascript array.

pub fn set<V: IntoJs<'js>>(&self, idx: usize, val: V) -> Result<()>[src]

Set the value at an index in the javascript array.

pub fn iter<T: FromJs<'js>>(&self) -> ArrayIter<'js, T>[src]

Get iterator over elments of an array

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

Reference as an object

pub fn into_object(self) -> Object<'js>[src]

Convert into an object

pub fn from_object(object: Object<'js>) -> Result<Self>[src]

Convert from an object

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

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

Reference to value

pub fn into_value(self) -> Value<'js>[src]

Convert into value

pub fn from_value(value: Value<'js>) -> Result<Self>[src]

Convert from value

Methods from Deref<Target = Value<'js>>

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

Try get bool from value

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

Try get int from value

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

Try get float from value

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

Try get any number from value

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

Check if the value is a bool

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

Check if the value is an int

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

Check if the value is a float

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

Check if the value is an any number

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

Check if the value is a string

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

Check if the value is a symbol

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

Check if the value is an object

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

Check if the value is a module

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

Check if the value is an array

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

Check if the value is a function

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

Check if the value is an error

pub fn as_value(&self) -> &Self[src]

Reference as value

pub fn get<T: FromJs<'js>>(&self) -> Result<T>[src]

Convert from value to specified type

pub fn type_of(&self) -> Type[src]

Get the type of value

pub fn type_name(&self) -> &'static str[src]

Get the name of type

pub unsafe fn ref_string(&self) -> &String<'js>[src]

Interprete as

Safety

You should be sure that the value already is of required type before to do it.

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

Try reinterprete as

pub unsafe fn ref_symbol(&self) -> &Symbol<'js>[src]

Interprete as

Safety

You should be sure that the value already is of required type before to do it.

pub fn as_symbol(&self) -> Option<&Symbol<'js>>[src]

Try reinterprete as

pub unsafe fn ref_object(&self) -> &Object<'js>[src]

Interprete as

Safety

You should be sure that the value already is of required type before to do it.

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

Try reinterprete as

pub unsafe fn ref_array(&self) -> &Array<'js>[src]

Interprete as

Safety

You should be sure that the value already is of required type before to do it.

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

Try reinterprete as

pub unsafe fn ref_function(&self) -> &Function<'js>[src]

Interprete as

Safety

You should be sure that the value already is of required type before to do it.

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

Try reinterprete as

pub unsafe fn ref_module(&self) -> &Module<'js, Evaluated>[src]

Interprete as

Safety

You should be sure that the value already is of required type before to do it.

pub fn as_module(&self) -> Option<&Module<'js, Evaluated>>[src]

Try reinterprete as

Trait Implementations

impl<'js> AsRef<Value<'js>> for Array<'js>[src]

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

impl<'js> Debug for Array<'js>[src]

impl<'js> Deref for Array<'js>[src]

type Target = Value<'js>

The resulting type after dereferencing.

impl<'js> From<Array<'js>> for Value<'js>[src]

impl<'js, A> FromIteratorJs<'js, A> for Array<'js> where
    A: IntoJs<'js>, 
[src]

type Item = Value<'js>

impl<'js> FromJs<'js> for Array<'js>[src]

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

impl<'js> IntoIterator for Array<'js>[src]

type Item = Result<Value<'js>>

The type of the elements being iterated over.

type IntoIter = ArrayIter<'js, Value<'js>>

Which kind of iterator are we turning this into?

impl<'js> IntoJs<'js> for Array<'js>[src]

impl<'js, 't> Outlive<'t> for Array<'js>[src]

type Target = Array<'t>

The target which has the same type as a Self but with another lifetime 't

impl<'js> PartialEq<Array<'js>> for Array<'js>[src]

impl<'js> StructuralPartialEq for Array<'js>[src]

Auto Trait Implementations

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

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

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

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

impl<'js> UnwindSafe for Array<'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.