Skip to main content

Array

Struct Array 

Source
pub struct Array<T = JsValue> { /* private fields */ }

Implementations§

Source§

impl Array

Source

pub fn new() -> Array

Source§

impl<T> Array<T>

Source

pub fn new_typed() -> Array<T>
where Array<T>: ErasableGenericOwn<Array<JsValue>> + EncodeTypeDef + BatchableResult,

Source§

impl Array

Source§

impl<T> Array<T>

Source

pub fn new_with_length_typed(len: u32) -> Array<T>
where Array<T>: ErasableGenericOwn<Array<JsValue>> + EncodeTypeDef + BatchableResult,

Source§

impl<T> Array<T>

Source

pub fn at(&self, index: i32) -> T
where T: ErasableGenericOwn<JsValue> + EncodeTypeDef + BatchableResult,

Source§

impl<T> Array<T>

Source

pub fn get(&self, index: u32) -> T
where T: ErasableGenericOwn<JsValue> + EncodeTypeDef + BatchableResult,

Source§

impl<T> Array<T>

Source

pub fn get_unchecked(&self, index: u32) -> T
where T: ErasableGenericOwn<JsValue> + EncodeTypeDef + BatchableResult,

Source§

impl<T> Array<T>

Source

pub fn get_checked(&self, index: u32) -> Option<T>
where Option<T>: ErasableGenericOwn<Option<JsValue>> + EncodeTypeDef + BatchableResult,

Source§

impl<T> Array<T>

Source

pub fn set(&self, index: u32, value: T)
where T: ErasableGenericOwn<JsValue> + EncodeTypeDef + BinaryEncode,

Source§

impl<T> Array<T>

Source

pub fn set_ref(&self, index: u32, value: &T)
where T: ErasableGenericBorrow<JsValue> + EncodeTypeDef, for<'__wry_bindgen> &'__wry_bindgen T: BinaryEncode,

Source§

impl<T> Array<T>

Source

pub fn delete(&self, index: u32)

Source§

impl Array

Source

pub fn from(val: &JsValue) -> Array

Source§

impl Array

Source

pub fn from_iterable<I>(val: &I) -> Result<Array<I::Item>, JsValue>
where I: ErasableGenericBorrow<JsValue> + EncodeTypeDef + Iterable, for<'__wry_bindgen> &'__wry_bindgen I: BinaryEncode, Result<Array<I::Item>, JsValue>: ErasableGenericOwn<Result<Array<JsValue>, JsValue>> + EncodeTypeDef + BatchableResult,

Source§

impl Array

Source

pub fn from_iterable_map<I, U>( val: &I, map: &mut dyn FnMut(I::Item, u32) -> Result<U, JsError>, ) -> Result<Array<U>, JsValue>
where I: ErasableGenericBorrow<JsValue> + EncodeTypeDef + Iterable, for<'__wry_bindgen> &'__wry_bindgen I: BinaryEncode, dyn FnMut(I::Item, u32) -> Result<U, JsError>: ErasableGenericBorrowMut<dyn FnMut(JsValue, u32) -> Result<JsValue, JsError>>, for<'__wry_bindgen> &'__wry_bindgen mut dyn FnMut(I::Item, u32) -> Result<U, JsError>: EncodeTypeDef + BinaryEncode, Result<Array<U>, JsValue>: ErasableGenericOwn<Result<Array<JsValue>, JsValue>> + EncodeTypeDef + BatchableResult,

Source§

impl Array

Source

pub fn from_async<I>(val: &I) -> Result<Promise<Array<I::Item>>, JsValue>
where I: ErasableGenericBorrow<JsValue> + EncodeTypeDef + AsyncIterable, for<'__wry_bindgen> &'__wry_bindgen I: BinaryEncode, Result<Promise<Array<I::Item>>, JsValue>: ErasableGenericOwn<Result<Promise<Array<JsValue>>, JsValue>> + EncodeTypeDef + BatchableResult,

Source§

impl Array

Source

pub fn from_async_map<'a, I, R: Promising>( val: &I, map: &ScopedClosure<'a, dyn FnMut(I::Item, u32) -> Result<R, JsError>>, ) -> Result<Promise<Array<R::Resolution>>, JsValue>
where I: ErasableGenericBorrow<JsValue> + EncodeTypeDef + AsyncIterable, for<'__wry_bindgen> &'__wry_bindgen I: BinaryEncode, ScopedClosure<'a, dyn FnMut(I::Item, u32) -> Result<R, JsError>>: ErasableGenericBorrow<ScopedClosure<'static, dyn FnMut(JsValue, u32) -> Result<JsValue, JsError>>>, Result<Promise<Array<R::Resolution>>, JsValue>: ErasableGenericOwn<Result<Promise<Array<JsValue>>, JsValue>> + EncodeTypeDef + BatchableResult,

Source§

impl<T> Array<T>

Source

pub fn copy_within(&self, target: i32, start: i32, end: i32) -> Array<T>
where Array<T>: ErasableGenericOwn<Array<JsValue>> + EncodeTypeDef + BatchableResult,

Source§

impl<T> Array<T>

Source

pub fn concat<U: Upcast<T>>(&self, array: &Array<U>) -> Array<T>
where Array<U>: ErasableGenericBorrow<Array<JsValue>> + EncodeTypeDef, for<'__wry_bindgen> &'__wry_bindgen Array<U>: BinaryEncode, Array<T>: ErasableGenericOwn<Array<JsValue>> + EncodeTypeDef + BatchableResult,

Source§

impl<T> Array<T>

Source

pub fn concat_many<U: Upcast<T>>(&self, array: &[Array<U>]) -> Array<T>
where [Array<U>]: ErasableGenericBorrow<[Array<JsValue>]>, Array<U>: EncodeTypeDef + JsGeneric, Array<T>: ErasableGenericOwn<Array<JsValue>> + EncodeTypeDef + BatchableResult,

Source§

impl<T> Array<T>

Source

pub fn every(&self, predicate: &mut dyn FnMut(T, u32, Array<T>) -> bool) -> bool
where dyn FnMut(T, u32, Array<T>) -> bool: ErasableGenericBorrowMut<dyn FnMut(JsValue, u32, Array<JsValue>) -> bool>, for<'__wry_bindgen> &'__wry_bindgen mut dyn FnMut(T, u32, Array<T>) -> bool: EncodeTypeDef + BinaryEncode,

Source§

impl<T> Array<T>

Source

pub fn try_every( &self, predicate: &mut dyn FnMut(T, u32) -> Result<bool, JsError>, ) -> Result<bool, JsValue>
where dyn FnMut(T, u32) -> Result<bool, JsError>: ErasableGenericBorrowMut<dyn FnMut(JsValue, u32) -> Result<bool, JsError>>, for<'__wry_bindgen> &'__wry_bindgen mut dyn FnMut(T, u32) -> Result<bool, JsError>: EncodeTypeDef + BinaryEncode,

Source§

impl<T> Array<T>

Source

pub fn fill(&self, value: &T, start: u32, end: u32) -> Array<T>
where T: ErasableGenericBorrow<JsValue> + EncodeTypeDef, for<'__wry_bindgen> &'__wry_bindgen T: BinaryEncode, Array<T>: ErasableGenericOwn<Array<JsValue>> + EncodeTypeDef + BatchableResult,

Source§

impl<T> Array<T>

Source

pub fn filter( &self, predicate: &mut dyn FnMut(T, u32, Array<T>) -> bool, ) -> Array<T>
where dyn FnMut(T, u32, Array<T>) -> bool: ErasableGenericBorrowMut<dyn FnMut(JsValue, u32, Array<JsValue>) -> bool>, for<'__wry_bindgen> &'__wry_bindgen mut dyn FnMut(T, u32, Array<T>) -> bool: EncodeTypeDef + BinaryEncode, Array<T>: ErasableGenericOwn<Array<JsValue>> + EncodeTypeDef + BatchableResult,

Source§

impl<T> Array<T>

Source

pub fn try_filter( &self, predicate: &mut dyn FnMut(T, u32) -> Result<bool, JsError>, ) -> Result<Array<T>, JsValue>
where dyn FnMut(T, u32) -> Result<bool, JsError>: ErasableGenericBorrowMut<dyn FnMut(JsValue, u32) -> Result<bool, JsError>>, for<'__wry_bindgen> &'__wry_bindgen mut dyn FnMut(T, u32) -> Result<bool, JsError>: EncodeTypeDef + BinaryEncode, Result<Array<T>, JsValue>: ErasableGenericOwn<Result<Array<JsValue>, JsValue>> + EncodeTypeDef + BatchableResult,

Source§

impl<T> Array<T>

Source

pub fn find(&self, predicate: &mut dyn FnMut(T, u32, Array<T>) -> bool) -> T
where dyn FnMut(T, u32, Array<T>) -> bool: ErasableGenericBorrowMut<dyn FnMut(JsValue, u32, Array<JsValue>) -> bool>, for<'__wry_bindgen> &'__wry_bindgen mut dyn FnMut(T, u32, Array<T>) -> bool: EncodeTypeDef + BinaryEncode, T: ErasableGenericOwn<JsValue> + EncodeTypeDef + BatchableResult,

Source§

impl<T> Array<T>

Source

pub fn try_find( &self, predicate: &mut dyn FnMut(T, u32) -> Result<bool, JsError>, ) -> Result<Option<T>, JsValue>
where dyn FnMut(T, u32) -> Result<bool, JsError>: ErasableGenericBorrowMut<dyn FnMut(JsValue, u32) -> Result<bool, JsError>>, for<'__wry_bindgen> &'__wry_bindgen mut dyn FnMut(T, u32) -> Result<bool, JsError>: EncodeTypeDef + BinaryEncode, Result<Option<T>, JsValue>: ErasableGenericOwn<Result<Option<JsValue>, JsValue>> + EncodeTypeDef + BatchableResult,

Source§

impl<T> Array<T>

Source

pub fn find_index( &self, predicate: &mut dyn FnMut(T, u32, Array<T>) -> bool, ) -> i32
where dyn FnMut(T, u32, Array<T>) -> bool: ErasableGenericBorrowMut<dyn FnMut(JsValue, u32, Array<JsValue>) -> bool>, for<'__wry_bindgen> &'__wry_bindgen mut dyn FnMut(T, u32, Array<T>) -> bool: EncodeTypeDef + BinaryEncode,

Source§

impl<T> Array<T>

Source

pub fn try_find_index( &self, predicate: &mut dyn FnMut(T, u32) -> Result<bool, JsError>, ) -> Result<i32, JsValue>
where dyn FnMut(T, u32) -> Result<bool, JsError>: ErasableGenericBorrowMut<dyn FnMut(JsValue, u32) -> Result<bool, JsError>>, for<'__wry_bindgen> &'__wry_bindgen mut dyn FnMut(T, u32) -> Result<bool, JsError>: EncodeTypeDef + BinaryEncode,

Source§

impl<T> Array<T>

Source

pub fn find_last( &self, predicate: &mut dyn FnMut(T, u32, Array<T>) -> bool, ) -> T
where dyn FnMut(T, u32, Array<T>) -> bool: ErasableGenericBorrowMut<dyn FnMut(JsValue, u32, Array<JsValue>) -> bool>, for<'__wry_bindgen> &'__wry_bindgen mut dyn FnMut(T, u32, Array<T>) -> bool: EncodeTypeDef + BinaryEncode, T: ErasableGenericOwn<JsValue> + EncodeTypeDef + BatchableResult,

Source§

impl<T> Array<T>

Source

pub fn try_find_last( &self, predicate: &mut dyn FnMut(T, u32) -> Result<bool, JsError>, ) -> Result<Option<T>, JsValue>
where dyn FnMut(T, u32) -> Result<bool, JsError>: ErasableGenericBorrowMut<dyn FnMut(JsValue, u32) -> Result<bool, JsError>>, for<'__wry_bindgen> &'__wry_bindgen mut dyn FnMut(T, u32) -> Result<bool, JsError>: EncodeTypeDef + BinaryEncode, Result<Option<T>, JsValue>: ErasableGenericOwn<Result<Option<JsValue>, JsValue>> + EncodeTypeDef + BatchableResult,

Source§

impl<T> Array<T>

Source

pub fn find_last_index( &self, predicate: &mut dyn FnMut(T, u32, Array<T>) -> bool, ) -> i32
where dyn FnMut(T, u32, Array<T>) -> bool: ErasableGenericBorrowMut<dyn FnMut(JsValue, u32, Array<JsValue>) -> bool>, for<'__wry_bindgen> &'__wry_bindgen mut dyn FnMut(T, u32, Array<T>) -> bool: EncodeTypeDef + BinaryEncode,

Source§

impl<T> Array<T>

Source

pub fn try_find_last_index( &self, predicate: &mut dyn FnMut(T, u32) -> Result<bool, JsError>, ) -> Result<i32, JsValue>
where dyn FnMut(T, u32) -> Result<bool, JsError>: ErasableGenericBorrowMut<dyn FnMut(JsValue, u32) -> Result<bool, JsError>>, for<'__wry_bindgen> &'__wry_bindgen mut dyn FnMut(T, u32) -> Result<bool, JsError>: EncodeTypeDef + BinaryEncode,

Source§

impl<T> Array<T>

Source

pub fn flat(&self, depth: i32) -> Array<JsValue>

Source§

impl<T> Array<T>

Source

pub fn flat_map<U>( &self, callback: &mut dyn FnMut(T, u32, Array<T>) -> Vec<U>, ) -> Array<U>
where dyn FnMut(T, u32, Array<T>) -> Vec<U>: ErasableGenericBorrowMut<dyn FnMut(JsValue, u32, Array<JsValue>) -> Vec<JsValue>>, for<'__wry_bindgen> &'__wry_bindgen mut dyn FnMut(T, u32, Array<T>) -> Vec<U>: EncodeTypeDef + BinaryEncode, Array<U>: ErasableGenericOwn<Array<JsValue>> + EncodeTypeDef + BatchableResult,

Source§

impl<T> Array<T>

Source

pub fn try_flat_map<U>( &self, callback: &mut dyn FnMut(T, u32) -> Vec<U>, ) -> Result<Array<U>, JsValue>
where dyn FnMut(T, u32) -> Vec<U>: ErasableGenericBorrowMut<dyn FnMut(JsValue, u32) -> Vec<JsValue>>, for<'__wry_bindgen> &'__wry_bindgen mut dyn FnMut(T, u32) -> Vec<U>: EncodeTypeDef + BinaryEncode, Result<Array<U>, JsValue>: ErasableGenericOwn<Result<Array<JsValue>, JsValue>> + EncodeTypeDef + BatchableResult,

Source§

impl<T: JsGeneric> Array<T>

Source

pub fn for_each(&self, callback: &mut dyn FnMut(T, u32, Array<T>))
where dyn FnMut(T, u32, Array<T>): ErasableGenericBorrowMut<dyn FnMut(JsValue, u32, Array<JsValue>)>, for<'__wry_bindgen> &'__wry_bindgen mut dyn FnMut(T, u32, Array<T>): EncodeTypeDef + BinaryEncode,

Source§

impl<T> Array<T>

Source

pub fn try_for_each( &self, callback: &mut dyn FnMut(T, u32) -> Result<(), JsError>, ) -> Result<(), JsValue>
where dyn FnMut(T, u32) -> Result<(), JsError>: ErasableGenericBorrowMut<dyn FnMut(JsValue, u32) -> Result<(), JsError>>, for<'__wry_bindgen> &'__wry_bindgen mut dyn FnMut(T, u32) -> Result<(), JsError>: EncodeTypeDef + BinaryEncode,

Source§

impl<T> Array<T>

Source

pub fn includes(&self, value: &T, from_index: i32) -> bool
where T: ErasableGenericBorrow<JsValue> + EncodeTypeDef, for<'__wry_bindgen> &'__wry_bindgen T: BinaryEncode,

Source§

impl<T> Array<T>

Source

pub fn index_of(&self, value: &T, from_index: i32) -> i32
where T: ErasableGenericBorrow<JsValue> + EncodeTypeDef, for<'__wry_bindgen> &'__wry_bindgen T: BinaryEncode,

Source§

impl Array

Source

pub fn is_array(value: &JsValue) -> bool

Source§

impl<T> Array<T>

Source

pub fn join(&self, delimiter: &str) -> JsString

Source§

impl<T> Array<T>

Source

pub fn last_index_of(&self, value: &T, from_index: i32) -> i32
where T: ErasableGenericBorrow<JsValue> + EncodeTypeDef, for<'__wry_bindgen> &'__wry_bindgen T: BinaryEncode,

Source§

impl<T> Array<T>

Source

pub fn length(&self) -> u32

Source§

impl<T> Array<T>

Source

pub fn set_length(&self, value: u32)

Source§

impl<T> Array<T>

Source

pub fn map<U>( &self, predicate: &mut dyn FnMut(T, u32, Array<T>) -> U, ) -> Array<U>
where dyn FnMut(T, u32, Array<T>) -> U: ErasableGenericBorrowMut<dyn FnMut(JsValue, u32, Array<JsValue>) -> JsValue>, for<'__wry_bindgen> &'__wry_bindgen mut dyn FnMut(T, u32, Array<T>) -> U: EncodeTypeDef + BinaryEncode, Array<U>: ErasableGenericOwn<Array<JsValue>> + EncodeTypeDef + BatchableResult,

Source§

impl<T> Array<T>

Source

pub fn try_map<U>( &self, predicate: &mut dyn FnMut(T, u32) -> Result<U, JsError>, ) -> Result<Array<U>, JsValue>
where dyn FnMut(T, u32) -> Result<U, JsError>: ErasableGenericBorrowMut<dyn FnMut(JsValue, u32) -> Result<JsValue, JsError>>, for<'__wry_bindgen> &'__wry_bindgen mut dyn FnMut(T, u32) -> Result<U, JsError>: EncodeTypeDef + BinaryEncode, Result<Array<U>, JsValue>: ErasableGenericOwn<Result<Array<JsValue>, JsValue>> + EncodeTypeDef + BatchableResult,

Source§

impl Array

Source

pub fn of<T>(values: &[T]) -> Array<T>
where [T]: ErasableGenericBorrow<[JsValue]>, T: EncodeTypeDef + JsGeneric, Array<T>: ErasableGenericOwn<Array<JsValue>> + EncodeTypeDef + BatchableResult,

Source§

impl Array

Source

pub fn of1(a: &JsValue) -> Array

Source§

impl Array

Source

pub fn of2(a: &JsValue, b: &JsValue) -> Array

Source§

impl Array

Source

pub fn of3(a: &JsValue, b: &JsValue, c: &JsValue) -> Array

Source§

impl Array

Source

pub fn of4(a: &JsValue, b: &JsValue, c: &JsValue, d: &JsValue) -> Array

Source§

impl Array

Source

pub fn of5( a: &JsValue, b: &JsValue, c: &JsValue, d: &JsValue, e: &JsValue, ) -> Array

Source§

impl<T> Array<T>

Source

pub fn pop(&self) -> T
where T: ErasableGenericOwn<JsValue> + EncodeTypeDef + BatchableResult,

Source§

impl<T> Array<T>

Source

pub fn pop_checked(&self) -> Option<T>
where Option<T>: ErasableGenericOwn<Option<JsValue>> + EncodeTypeDef + BatchableResult,

Source§

impl<T> Array<T>

Source

pub fn push(&self, value: &T) -> u32
where T: ErasableGenericBorrow<JsValue> + EncodeTypeDef, for<'__wry_bindgen> &'__wry_bindgen T: BinaryEncode,

Source§

impl<T> Array<T>

Source

pub fn push_many(&self, values: &[T]) -> u32
where [T]: ErasableGenericBorrow<[JsValue]>, T: EncodeTypeDef + JsGeneric,

Source§

impl<T> Array<T>

Source

pub fn reduce( &self, predicate: &mut dyn FnMut(JsValue, T, u32, Array<T>) -> JsValue, initial_value: &JsValue, ) -> JsValue
where dyn FnMut(JsValue, T, u32, Array<T>) -> JsValue: ErasableGenericBorrowMut<dyn FnMut(JsValue, JsValue, u32, Array<JsValue>) -> JsValue>, for<'__wry_bindgen> &'__wry_bindgen mut dyn FnMut(JsValue, T, u32, Array<T>) -> JsValue: EncodeTypeDef + BinaryEncode,

Source§

impl<T> Array<T>

Source

pub fn try_reduce<A>( &self, predicate: &mut dyn FnMut(A, T, u32) -> Result<A, JsError>, initial_value: &A, ) -> Result<A, JsValue>
where dyn FnMut(A, T, u32) -> Result<A, JsError>: ErasableGenericBorrowMut<dyn FnMut(JsValue, JsValue, u32) -> Result<JsValue, JsError>>, for<'__wry_bindgen> &'__wry_bindgen mut dyn FnMut(A, T, u32) -> Result<A, JsError>: EncodeTypeDef + BinaryEncode, A: ErasableGenericBorrow<JsValue> + EncodeTypeDef, for<'__wry_bindgen> &'__wry_bindgen A: BinaryEncode, Result<A, JsValue>: ErasableGenericOwn<Result<JsValue, JsValue>> + EncodeTypeDef + BatchableResult,

Source§

impl<T> Array<T>

Source

pub fn reduce_right( &self, predicate: &mut dyn FnMut(JsValue, T, u32, Array<T>) -> JsValue, initial_value: &JsValue, ) -> JsValue
where dyn FnMut(JsValue, T, u32, Array<T>) -> JsValue: ErasableGenericBorrowMut<dyn FnMut(JsValue, JsValue, u32, Array<JsValue>) -> JsValue>, for<'__wry_bindgen> &'__wry_bindgen mut dyn FnMut(JsValue, T, u32, Array<T>) -> JsValue: EncodeTypeDef + BinaryEncode,

Source§

impl<T> Array<T>

Source

pub fn try_reduce_right<A>( &self, predicate: &mut dyn FnMut(JsValue, T, u32) -> Result<A, JsError>, initial_value: &A, ) -> Result<A, JsValue>
where dyn FnMut(JsValue, T, u32) -> Result<A, JsError>: ErasableGenericBorrowMut<dyn FnMut(JsValue, JsValue, u32) -> Result<JsValue, JsError>>, for<'__wry_bindgen> &'__wry_bindgen mut dyn FnMut(JsValue, T, u32) -> Result<A, JsError>: EncodeTypeDef + BinaryEncode, A: ErasableGenericBorrow<JsValue> + EncodeTypeDef, for<'__wry_bindgen> &'__wry_bindgen A: BinaryEncode, Result<A, JsValue>: ErasableGenericOwn<Result<JsValue, JsValue>> + EncodeTypeDef + BatchableResult,

Source§

impl<T> Array<T>

Source

pub fn reverse(&self) -> Array<T>
where Array<T>: ErasableGenericOwn<Array<JsValue>> + EncodeTypeDef + BatchableResult,

Source§

impl<T> Array<T>

Source

pub fn shift(&self) -> T
where T: ErasableGenericOwn<JsValue> + EncodeTypeDef + BatchableResult,

Source§

impl<T> Array<T>

Source

pub fn shift_checked(&self) -> Option<T>
where Option<T>: ErasableGenericOwn<Option<JsValue>> + EncodeTypeDef + BatchableResult,

Source§

impl<T> Array<T>

Source

pub fn slice(&self, start: u32, end: u32) -> Array<T>
where Array<T>: ErasableGenericOwn<Array<JsValue>> + EncodeTypeDef + BatchableResult,

Source§

impl<T> Array<T>

Source

pub fn slice_from(&self, start: u32) -> Array<T>
where Array<T>: ErasableGenericOwn<Array<JsValue>> + EncodeTypeDef + BatchableResult,

Source§

impl<T> Array<T>

Source

pub fn some(&self, predicate: &mut dyn FnMut(T) -> bool) -> bool
where dyn FnMut(T) -> bool: ErasableGenericBorrowMut<dyn FnMut(JsValue) -> bool>, for<'__wry_bindgen> &'__wry_bindgen mut dyn FnMut(T) -> bool: EncodeTypeDef + BinaryEncode,

Source§

impl<T> Array<T>

Source

pub fn try_some( &self, predicate: &mut dyn FnMut(T) -> Result<bool, JsError>, ) -> Result<bool, JsValue>
where dyn FnMut(T) -> Result<bool, JsError>: ErasableGenericBorrowMut<dyn FnMut(JsValue) -> Result<bool, JsError>>, for<'__wry_bindgen> &'__wry_bindgen mut dyn FnMut(T) -> Result<bool, JsError>: EncodeTypeDef + BinaryEncode,

Source§

impl<T> Array<T>

Source

pub fn sort(&self) -> Array<T>
where Array<T>: ErasableGenericOwn<Array<JsValue>> + EncodeTypeDef + BatchableResult,

Source§

impl<T> Array<T>

Source

pub fn sort_by(&self, compare_fn: &mut dyn FnMut(T, T) -> i32) -> Array<T>
where dyn FnMut(T, T) -> i32: ErasableGenericBorrowMut<dyn FnMut(JsValue, JsValue) -> i32>, for<'__wry_bindgen> &'__wry_bindgen mut dyn FnMut(T, T) -> i32: EncodeTypeDef + BinaryEncode, Array<T>: ErasableGenericOwn<Array<JsValue>> + EncodeTypeDef + BatchableResult,

Source§

impl<T> Array<T>

Source

pub fn try_sort_by( &self, compare_fn: &mut dyn FnMut(T, T) -> Result<i32, JsError>, ) -> Result<Array<T>, JsValue>
where dyn FnMut(T, T) -> Result<i32, JsError>: ErasableGenericBorrowMut<dyn FnMut(JsValue, JsValue) -> Result<i32, JsError>>, for<'__wry_bindgen> &'__wry_bindgen mut dyn FnMut(T, T) -> Result<i32, JsError>: EncodeTypeDef + BinaryEncode, Result<Array<T>, JsValue>: ErasableGenericOwn<Result<Array<JsValue>, JsValue>> + EncodeTypeDef + BatchableResult,

Source§

impl<T> Array<T>

Source

pub fn splice(&self, start: u32, delete_count: u32, item: &T) -> Array<T>
where T: ErasableGenericBorrow<JsValue> + EncodeTypeDef, for<'__wry_bindgen> &'__wry_bindgen T: BinaryEncode, Array<T>: ErasableGenericOwn<Array<JsValue>> + EncodeTypeDef + BatchableResult,

Source§

impl<T> Array<T>

Source

pub fn splice_many( &self, start: u32, delete_count: u32, items: &[T], ) -> Array<T>
where [T]: ErasableGenericBorrow<[JsValue]>, T: EncodeTypeDef + JsGeneric, Array<T>: ErasableGenericOwn<Array<JsValue>> + EncodeTypeDef + BatchableResult,

Source§

impl<T> Array<T>

Source

pub fn to_locale_string(&self, locales: &JsValue, options: &JsValue) -> JsString

Source§

impl<T> Array<T>

Source

pub fn to_reversed(&self) -> Array<T>
where Array<T>: ErasableGenericOwn<Array<JsValue>> + EncodeTypeDef + BatchableResult,

Source§

impl<T> Array<T>

Source

pub fn to_sorted(&self) -> Array<T>
where Array<T>: ErasableGenericOwn<Array<JsValue>> + EncodeTypeDef + BatchableResult,

Source§

impl<T> Array<T>

Source

pub fn to_sorted_by(&self, compare_fn: &mut dyn FnMut(T, T) -> i32) -> Array<T>
where dyn FnMut(T, T) -> i32: ErasableGenericBorrowMut<dyn FnMut(JsValue, JsValue) -> i32>, for<'__wry_bindgen> &'__wry_bindgen mut dyn FnMut(T, T) -> i32: EncodeTypeDef + BinaryEncode, Array<T>: ErasableGenericOwn<Array<JsValue>> + EncodeTypeDef + BatchableResult,

Source§

impl<T> Array<T>

Source

pub fn try_to_sorted_by( &self, compare_fn: &mut dyn FnMut(T, T) -> Result<i32, JsError>, ) -> Result<Array<T>, JsValue>
where dyn FnMut(T, T) -> Result<i32, JsError>: ErasableGenericBorrowMut<dyn FnMut(JsValue, JsValue) -> Result<i32, JsError>>, for<'__wry_bindgen> &'__wry_bindgen mut dyn FnMut(T, T) -> Result<i32, JsError>: EncodeTypeDef + BinaryEncode, Result<Array<T>, JsValue>: ErasableGenericOwn<Result<Array<JsValue>, JsValue>> + EncodeTypeDef + BatchableResult,

Source§

impl<T> Array<T>

Source

pub fn to_spliced(&self, start: u32, delete_count: u32, items: &[T]) -> Array<T>
where [T]: ErasableGenericBorrow<[JsValue]>, T: EncodeTypeDef + JsGeneric, Array<T>: ErasableGenericOwn<Array<JsValue>> + EncodeTypeDef + BatchableResult,

Source§

impl<T> Array<T>

Source

pub fn to_string(&self) -> JsString

Source§

impl<T> Array<T>

Source

pub fn to_vec(&self) -> Vec<T>
where Vec<T>: ErasableGenericOwn<Vec<JsValue>> + EncodeTypeDef + BatchableResult,

Source§

impl<T> Array<T>

Source

pub fn unshift(&self, value: &T) -> u32
where T: ErasableGenericBorrow<JsValue> + EncodeTypeDef, for<'__wry_bindgen> &'__wry_bindgen T: BinaryEncode,

Source§

impl<T> Array<T>

Source

pub fn unshift_many(&self, values: &[T]) -> u32
where [T]: ErasableGenericBorrow<[JsValue]>, T: EncodeTypeDef + JsGeneric,

Source§

impl<T> Array<T>

Source

pub fn with(&self, index: u32, value: &T) -> Array<T>
where T: ErasableGenericBorrow<JsValue> + EncodeTypeDef, for<'__wry_bindgen> &'__wry_bindgen T: BinaryEncode, Array<T>: ErasableGenericOwn<Array<JsValue>> + EncodeTypeDef + BatchableResult,

Source§

impl<T: JsGeneric> Array<T>

Source

pub fn iter(&self) -> ArrayIter<'_, T>

Returns an iterator over the values of the JS array.

Source§

impl<T: JsGeneric> Array<T>

Source

pub fn from_iter_typed<A, I>(iter: I) -> Array<T>
where A: IntoJsGeneric<JsCanon = T>, I: IntoIterator<Item = A>,

Collect an iterator into a typed Array<T>, projecting each item through its canonical JsGeneric via IntoJsGeneric.

This is the typed counterpart to the stable impl FromIterator<A> for Array where A: AsRef<JsValue>, which always produces an erased Array<JsValue>. Use from_iter_typed when you want the element type inferred from the iterator item:

use js_sys::{Array, Number};

let arr = Array::from_iter_typed((0..10).map(Number::from));
// arr: Array<Number>

Reference iteration (Item = &U) is supported transparently via the &U: IntoJsGeneric blanket in wasm-bindgen core.

Source

pub fn extend_typed<A, I>(&mut self, iter: I)
where A: IntoJsGeneric<JsCanon = T>, I: IntoIterator<Item = A>,

Extend a typed Array<T> with an iterator of items convertible to T via IntoJsGeneric. Companion to Array::from_iter_typed.

Source§

impl<T> Array<T>

Source

pub fn keys(&self) -> Iterator<T>
where Iterator<T>: ErasableGenericOwn<Iterator<JsValue>> + EncodeTypeDef + BatchableResult,

Source§

impl<T> Array<T>

Source

pub fn entries(&self) -> Iterator<T>
where Iterator<T>: ErasableGenericOwn<Iterator<JsValue>> + EncodeTypeDef + BatchableResult,

👎Deprecated:

recommended to use Array::entries_typed instead for typing

Source§

impl<T: JsGeneric> Array<T>

Source§

impl<T> Array<T>

Source

pub fn values(&self) -> Iterator<T>
where Iterator<T>: ErasableGenericOwn<Iterator<JsValue>> + EncodeTypeDef + BatchableResult,

Methods from Deref<Target = Object>§

Source

pub fn constructor(&self) -> Function

Source

pub fn has_own_property(&self, property: &JsValue) -> bool

👎Deprecated:

Use Object::hasOwn instead.

Source

pub fn is_prototype_of(&self, value: &JsValue) -> bool

Source

pub fn property_is_enumerable(&self, property: &JsValue) -> bool

Source

pub fn to_locale_string(&self) -> JsString

Source

pub fn to_string(&self) -> JsString

Source

pub fn to_js_string(&self) -> JsString

Source

pub fn value_of(&self) -> Object

Methods from Deref<Target = JsValue>§

Source

pub const NULL: JsValue

Source

pub const UNDEFINED: JsValue

Source

pub const TRUE: JsValue

Source

pub const FALSE: JsValue

Source

pub fn unchecked_into_f64(&self) -> f64

Returns the value as f64 without type checking. Used by serde-wasm-bindgen for numeric conversions.

Source

pub fn has_type<T>(&self) -> bool
where T: JsCast,

Check if this value is an instance of a specific JS type.

Source

pub fn checked_div(&self, rhs: &JsValue) -> JsValue

Checked division.

Source

pub fn pow(&self, rhs: &JsValue) -> JsValue

Power operation.

Source

pub fn bit_and(&self, rhs: &JsValue) -> JsValue

Bitwise AND.

Source

pub fn bit_or(&self, rhs: &JsValue) -> JsValue

Bitwise OR.

Source

pub fn bit_xor(&self, rhs: &JsValue) -> JsValue

Bitwise XOR.

Source

pub fn bit_not(&self) -> JsValue

Bitwise NOT.

Source

pub fn shl(&self, rhs: &JsValue) -> JsValue

Left shift.

Source

pub fn shr(&self, rhs: &JsValue) -> JsValue

Signed right shift.

Source

pub fn unsigned_shr(&self, rhs: &JsValue) -> u32

Unsigned right shift.

Source

pub fn add(&self, rhs: &JsValue) -> JsValue

Add.

Source

pub fn sub(&self, rhs: &JsValue) -> JsValue

Subtract.

Source

pub fn mul(&self, rhs: &JsValue) -> JsValue

Multiply.

Source

pub fn div(&self, rhs: &JsValue) -> JsValue

Divide.

Source

pub fn rem(&self, rhs: &JsValue) -> JsValue

Remainder.

Source

pub fn neg(&self) -> JsValue

Negate.

Source

pub fn lt(&self, other: &JsValue) -> bool

Less than comparison.

Source

pub fn le(&self, other: &JsValue) -> bool

Less than or equal comparison.

Source

pub fn gt(&self, other: &JsValue) -> bool

Greater than comparison.

Source

pub fn ge(&self, other: &JsValue) -> bool

Greater than or equal comparison.

Source

pub fn loose_eq(&self, other: &JsValue) -> bool

Loose equality (==).

Source

pub fn is_falsy(&self) -> bool

Check if this value is a falsy value in JavaScript.

Source

pub fn is_truthy(&self) -> bool

Check if this value is a truthy value in JavaScript.

Source

pub fn is_object(&self) -> bool

Check if this value is an object.

Source

pub fn is_function(&self) -> bool

Check if this value is a function.

Source

pub fn is_string(&self) -> bool

Check if this value is a string.

Source

pub fn is_symbol(&self) -> bool

Check if this value is a symbol.

Source

pub fn is_bigint(&self) -> bool

Check if this value is a bigint.

Source

pub fn is_array(&self) -> bool

Check if this value is an Array.

Source

pub fn is_undefined(&self) -> bool

Check if this value is undefined.

Source

pub fn is_null(&self) -> bool

Check if this value is null.

Source

pub fn is_null_or_undefined(&self) -> bool

Check if this value is null or undefined.

Source

pub fn js_typeof(&self) -> JsValue

Get the typeof this value as a string.

Source

pub fn js_in(&self, obj: &JsValue) -> bool

Check if this value has a property with the given name.

Source

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

Get the value as a bool.

Source

pub fn as_f64(&self) -> Option<f64>

Get the value as an f64.

Source

pub fn as_string(&self) -> Option<String>

Get the value as a string.

Source

pub fn as_debug_string(&self) -> String

Get a debug string representation of the value.

Trait Implementations§

Source§

impl<T> AsRef<Array<T>> for Array<T>

Source§

fn as_ref(&self) -> &Array<T>

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<Array> for RegExpMatchArray

Source§

fn as_ref(&self) -> &Array

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<T> AsRef<JsValue> for Array<T>

Source§

fn as_ref(&self) -> &JsValue

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<T> AsRef<Object> for Array<T>

Source§

fn as_ref(&self) -> &Object

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<T> BatchableResult for Array<T>

Source§

fn try_placeholder(batch: &mut Runtime<'_>) -> Option<Self>

Source§

impl<T> BinaryDecode for Array<T>

Source§

fn decode(decoder: &mut DecodedData<'_>) -> Result<Self, DecodeError>

Source§

impl<T> BinaryEncode for Array<T>

Source§

fn encode(self, encoder: &mut EncodedData)

Source§

impl<T: Clone> Clone for Array<T>

Source§

fn clone(&self) -> Array<T>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug> Debug for Array<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Array<JsValue>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<T> Deref for Array<T>

Source§

type Target = Object

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Object

Dereferences the value.
Source§

impl<T> EncodeTypeDef for Array<T>

Source§

fn encode_type_def(type_def: &mut TypeDef)

Source§

impl<T: Eq> Eq for Array<T>

Source§

impl<T> ErasableGeneric for Array<T>

Source§

impl<A> Extend<A> for Array
where A: AsRef<JsValue>,

Source§

fn extend<I>(&mut self, iter: I)
where I: IntoIterator<Item = A>,

Extends a collection with the contents of an iterator. Read more
Source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Source§

impl<T> From<Array<T>> for JsValue

Source§

fn from(val: Array<T>) -> Self

Converts to this type from the input type.
Source§

impl<T> From<Array<T>> for Object

Source§

fn from(val: Array<T>) -> Object

Converts to this type from the input type.
Source§

impl<T> From<JsValue> for Array<T>

Source§

fn from(val: JsValue) -> Self

Converts to this type from the input type.
Source§

impl From<RegExpMatchArray> for Array

Source§

fn from(val: RegExpMatchArray) -> Array

Converts to this type from the input type.
Source§

impl<A> FromIterator<A> for Array
where A: AsRef<JsValue>,

Source§

fn from_iter<I>(iter: I) -> Array
where I: IntoIterator<Item = A>,

Creates a value from an iterator. Read more
Source§

impl<T: JsGeneric> IntoIterator for Array<T>

Source§

type Item = T

The type of the elements being iterated over.
Source§

type IntoIter = ArrayIntoIter<T>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<T: 'static> IntoJsGeneric for Array<T>
where Array<T>: JsGeneric,

Source§

type JsCanon = Array<T>

Source§

fn to_js(self) -> Self::JsCanon

Source§

impl<T> Iterable for Array<T>

Source§

type Item = T

The type of values yielded by this iterable.
Source§

impl<T> JsCast for Array<T>

Source§

fn instanceof(__val: &JsValue) -> bool

Check if a JsValue is an instance of this type. Read more
Source§

fn is_type_of(__val: &JsValue) -> bool

Performs a dynamic type check to see whether the JsValue provided is a value of this type. Read more
Source§

fn unchecked_from_js(val: JsValue) -> Self

Unchecked cast from JsValue to this type. Read more
Source§

fn unchecked_from_js_ref(val: &JsValue) -> &Self

Unchecked cast from a JsValue reference to a reference of this type. Read more
Source§

fn has_type<T>(&self) -> bool
where T: JsCast,

Test whether this JS value has a type T. Read more
Source§

fn dyn_into<T>(self) -> Result<T, Self>
where T: JsCast,

Try to cast this value to type T. Read more
Source§

fn dyn_ref<T>(&self) -> Option<&T>
where T: JsCast,

Try to get a reference to type T from this value. Read more
Source§

fn is_instance_of<T>(&self) -> bool
where T: JsCast,

Test whether this JS value is an instance of the type T. Read more
Source§

fn unchecked_into<T>(self) -> T
where T: JsCast,

Unchecked cast to another type.
Source§

fn unchecked_ref<T>(&self) -> &T
where T: JsCast,

Unchecked cast to a reference of another type.
Source§

impl<T> JsRefEncode for Array<T>

Source§

fn js_ref(&self) -> JsRef

Source§

impl<T: PartialEq> PartialEq for Array<T>

Source§

fn eq(&self, other: &Array<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T> Promising for Array<T>

Source§

impl<T> StructuralPartialEq for Array<T>

Source§

impl<T> UpcastFrom<Array<T>> for JsValue

Source§

impl<T> UpcastFrom<Array<T>> for JsOption<JsValue>

Source§

impl<T, __WryUpcastTarget0> UpcastFrom<Array<T>> for Array<__WryUpcastTarget0>
where __WryUpcastTarget0: UpcastFrom<T>,

Source§

impl<T, __WryUpcastTarget0> UpcastFrom<Array<T>> for JsOption<Array<__WryUpcastTarget0>>
where __WryUpcastTarget0: UpcastFrom<T>,

Source§

impl<T> UpcastFrom<Array<T>> for Object

Source§

impl<T> UpcastFrom<Array<T>> for JsOption<Object>

Source§

impl<T1, T2, Target> UpcastFrom<ArrayTuple<(T1, T2)>> for Array<Target>
where Target: UpcastFrom<T1> + UpcastFrom<T2>,

Source§

impl<T1, T2, T3, Target> UpcastFrom<ArrayTuple<(T1, T2, T3)>> for Array<Target>
where Target: UpcastFrom<T1> + UpcastFrom<T2> + UpcastFrom<T3>,

Source§

impl<T1, T2, T3, T4, Target> UpcastFrom<ArrayTuple<(T1, T2, T3, T4)>> for Array<Target>
where Target: UpcastFrom<T1> + UpcastFrom<T2> + UpcastFrom<T3> + UpcastFrom<T4>,

Source§

impl<T1, T2, T3, T4, T5, Target> UpcastFrom<ArrayTuple<(T1, T2, T3, T4, T5)>> for Array<Target>
where Target: UpcastFrom<T1> + UpcastFrom<T2> + UpcastFrom<T3> + UpcastFrom<T4> + UpcastFrom<T5>,

Source§

impl<T1, T2, T3, T4, T5, T6, Target> UpcastFrom<ArrayTuple<(T1, T2, T3, T4, T5, T6)>> for Array<Target>
where Target: UpcastFrom<T1> + UpcastFrom<T2> + UpcastFrom<T3> + UpcastFrom<T4> + UpcastFrom<T5> + UpcastFrom<T6>,

Source§

impl<T1, T2, T3, T4, T5, T6, T7, Target> UpcastFrom<ArrayTuple<(T1, T2, T3, T4, T5, T6, T7)>> for Array<Target>
where Target: UpcastFrom<T1> + UpcastFrom<T2> + UpcastFrom<T3> + UpcastFrom<T4> + UpcastFrom<T5> + UpcastFrom<T6> + UpcastFrom<T7>,

Source§

impl<T1, T2, T3, T4, T5, T6, T7, T8, Target> UpcastFrom<ArrayTuple<(T1, T2, T3, T4, T5, T6, T7, T8)>> for Array<Target>
where Target: UpcastFrom<T1> + UpcastFrom<T2> + UpcastFrom<T3> + UpcastFrom<T4> + UpcastFrom<T5> + UpcastFrom<T6> + UpcastFrom<T7> + UpcastFrom<T8>,

Source§

impl<T1, Target> UpcastFrom<ArrayTuple<(T1,)>> for Array<Target>
where Target: UpcastFrom<T1>,

Source§

impl UpcastFrom<RegExpMatchArray> for Array

Auto Trait Implementations§

§

impl<T> Freeze for Array<T>

§

impl<T> RefUnwindSafe for Array<T>

§

impl<T> Send for Array<T>

§

impl<T> Sync for Array<T>

§

impl<T> Unpin for Array<T>

§

impl<T> UnsafeUnpin for Array<T>

§

impl<T> UnwindSafe for Array<T>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromJsFuture for T
where T: TryFromJsValue,

Source§

impl<T> FromWasmAbi for T
where T: JsGeneric,

Source§

unsafe fn from_abi(js: u32) -> Self
where Self: Sized + FromAbiId,

Recreate a JS-reference-like value from a heap id. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoWasmAbi for T
where T: JsGeneric,

Source§

fn into_abi(self) -> u32
where Self: Sized + IntoAbiId,

Source§

impl<T> JsGeneric for T

Source§

impl<T> OptionFromWasmAbi for T
where T: FromWasmAbi,

Source§

impl<T> OptionIntoWasmAbi for T
where T: IntoWasmAbi,

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> RefFromWasmAbi for T
where T: ?Sized,

Source§

unsafe fn ref_from_abi(js: u32) -> AbiRef<Self>
where Self: Sized + FromAbiId,

Recreate a non-dropping reference anchor from a heap id. Read more
Source§

impl<T> ReturnSync for T
where T: IntoWasmAbi,

Source§

fn return_abi(self, encoder: &mut EncodedData)

Encode self as the function’s return payload.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T> TryFromJsValue for T
where T: JsCast,

Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Source§

impl<T> WasmAbi for T
where T: ?Sized,