nanvm_lib/vm/array/mod.rs
1mod argument;
2mod at;
3pub(crate) mod callback;
4mod concat;
5pub(crate) mod create;
6mod every;
7mod filter;
8mod find;
9mod find_index;
10mod find_last_index;
11mod flat;
12mod includes;
13mod index;
14mod index_of;
15mod join;
16mod last_index_of;
17mod map;
18mod member_access;
19mod partial_eq;
20mod reduce;
21mod rest;
22mod slice;
23mod some;
24mod to_reversed;
25mod to_sorted;
26mod to_spliced;
27mod with;
28
29pub mod to_array;
30
31use crate::vm::IVm;
32
33/// ```
34/// use nanvm_lib::{
35/// vm::{ToArray, IVm, Array, Any, Number, ToAny},
36/// common::{sized_index::SizedIndex, default::default},
37/// naive::Naive
38/// };
39/// fn array_test<A: IVm>() {
40/// let b: Array<A> = [Number::from(1.0).to_any(), true.to_any()].to_array();
41/// assert_eq!(b.length(), 2);
42/// assert_eq!(b[0], Number::from(1.0).to_any());
43/// assert_eq!(b[1], true.to_any());
44/// let b1: Array<A> = [Number::from(1.0).to_any(), true.to_any()].to_array();
45/// assert_eq!(b, b);
46/// assert_ne!(b, b1);
47/// let ac: Any<A> = b.clone().to_any();
48/// let d: Array<A> = ac.try_into().unwrap();
49/// assert_eq!(d, b);
50/// let e0: Array<A> = default();
51/// let e1: Array<A> = [].to_array();
52/// assert_ne!(e0, e1);
53/// }
54///
55/// array_test::<Naive>();
56/// ```
57#[derive(Clone)]
58pub struct Array<A: IVm>(A::InternalArray);