[−][src]Struct ducc::Array
Reference to a JavaScript array.
Implementations
impl<'ducc> Array<'ducc>
[src]
pub fn into_object(self) -> Object<'ducc>
[src]
Consumes the array and returns it as a JavaScript object. This is inexpensive, since an array is an object.
pub fn get<V: FromValue<'ducc>>(&self, index: u32) -> Result<V>
[src]
Get the value using the given array index. Returns Value::Undefined
if no element at the
index exists.
Errors
This function returns an error if:
FromValue::from_value
fails for the element
pub fn set<V: ToValue<'ducc>>(&self, index: u32, value: V) -> Result<()>
[src]
Sets an array element using the given index and value.
Errors
This function returns an error if:
ToValue::to_value
fails for the value
pub fn len(&self) -> Result<usize>
[src]
Returns the number of elements in the array using the calculation
Math.floor(ToNumber(array.length))
. This function can return an error if the ToNumber
implementation fails or if the length
getter fails.
pub fn push<V: ToValue<'ducc>>(&self, value: V) -> Result<()>
[src]
Pushes an element to the end of the array. This is a shortcut for set
using len
as the
index.
pub fn elements<V: FromValue<'ducc>>(self) -> Elements<'ducc, V>
[src]
Returns an iterator over the array's indexable values.
Trait Implementations
impl<'ducc> Clone for Array<'ducc>
[src]
impl<'ducc> Debug for Array<'ducc>
[src]
impl<'ducc> FromValue<'ducc> for Array<'ducc>
[src]
impl<'ducc> ToValue<'ducc> for Array<'ducc>
[src]
Auto Trait Implementations
impl<'ducc> RefUnwindSafe for Array<'ducc>
impl<'ducc> !Send for Array<'ducc>
impl<'ducc> !Sync for Array<'ducc>
impl<'ducc> Unpin for Array<'ducc>
impl<'ducc> UnwindSafe for Array<'ducc>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
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> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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>,