Struct rquickjs_core::Array
source · [−]#[repr(transparent)]pub struct Array<'js>(_);
Expand description
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
sourceimpl<'js> Array<'js>
impl<'js> Array<'js>
pub fn new(ctx: Ctx<'js>) -> Result<Self>
sourcepub fn get<V: FromJs<'js>>(&self, idx: usize) -> Result<V>
pub fn get<V: FromJs<'js>>(&self, idx: usize) -> Result<V>
Get the value at an index in the javascript array.
sourcepub fn set<V: IntoJs<'js>>(&self, idx: usize, val: V) -> Result<()>
pub fn set<V: IntoJs<'js>>(&self, idx: usize, val: V) -> Result<()>
Set the value at an index in the javascript array.
sourcepub fn into_object(self) -> Object<'js>
pub fn into_object(self) -> Object<'js>
Convert into an object
sourcepub fn from_object(object: Object<'js>) -> Result<Self>
pub fn from_object(object: Object<'js>) -> Result<Self>
Convert from an object
Methods from Deref<Target = Value<'js>>
sourcepub fn is_function(&self) -> bool
pub fn is_function(&self) -> bool
Check if the value is a function
sourcepub unsafe fn ref_string(&self) -> &String<'js>
pub unsafe fn ref_string(&self) -> &String<'js>
sourcepub unsafe fn ref_symbol(&self) -> &Symbol<'js>
pub unsafe fn ref_symbol(&self) -> &Symbol<'js>
sourcepub unsafe fn ref_object(&self) -> &Object<'js>
pub unsafe fn ref_object(&self) -> &Object<'js>
sourcepub unsafe fn ref_function(&self) -> &Function<'js>
pub unsafe fn ref_function(&self) -> &Function<'js>
sourcepub fn as_function(&self) -> Option<&Function<'js>>
pub fn as_function(&self) -> Option<&Function<'js>>
Try reinterprete as
Trait Implementations
sourceimpl<'js, A> FromIteratorJs<'js, A> for Array<'js> where
A: IntoJs<'js>,
impl<'js, A> FromIteratorJs<'js, A> for Array<'js> where
A: IntoJs<'js>,
type Item = Value<'js>
fn from_iter_js<T>(ctx: Ctx<'js>, iter: T) -> Result<Self> where
T: IntoIterator<Item = A>,
sourceimpl<'js> IntoIterator for Array<'js>
impl<'js> IntoIterator for Array<'js>
sourceimpl<'js> PartialEq<Array<'js>> for Array<'js>
impl<'js> PartialEq<Array<'js>> for Array<'js>
impl<'js> StructuralPartialEq for Array<'js>
Auto Trait Implementations
impl<'js> !RefUnwindSafe for Array<'js>
impl<'js> !Send for Array<'js>
impl<'js> !Sync for Array<'js>
impl<'js> Unpin for Array<'js>
impl<'js> UnwindSafe for Array<'js>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more