1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
//! An expandable data array used to add data to the beginning of the array.
//!
//! # Examples
//!
//! ```
//! use cev::Cev;
//!
//! let mut cev = Cev::new();
//! cev.push(1);
//! cev.push(2);
//!
//! assert_eq!(cev.len(), 2);
//! assert_eq!(cev[0], 2);
//!
//! assert_eq!(cev.pop(), Some(2));
//! assert_eq!(cev.len(), 1);
//!
//! cev[0] = 4;
//! assert_eq!(cev[0], 4);
//!
//! let mut cev_app = Cev::from([1, 2, 3]);
//! cev.append(&mut cev_app);
//! assert_eq!(cev, [1, 2, 3, 4]);
//!
//! let mut cev_list = (0..6).collect::<Cev<_>>();
//! assert_eq!(cev_list, [0, 1, 2, 3, 4, 5]);
//! ```
//!
//! A `Cev` array containing the elements of type `u8` `a` and `b` with capacity 4 can be
//! visualized as below.
//!
//! ```text
//! mov_ptr raw_ptr len capacity
//! Any mem +--------+--------+--------+--------+
//! |¹0x0124 |²0x0122 | 2 | 4 |
//! +--------+--------+--------+--------+
//! |
//! v
//! Heap +--------+--------+--------+--------+
//! | uninit | uninit | b | a |
//! +--------+--------+--------+--------+
//! |
//! v
//! Pointer +--------+--------+--------+--------+
//! | 0x0122 | 0x0123 | 0x0124 | 0x0125 |
//! +--------+--------+--------+--------+
//! <--
//!
//! ¹ Beginning of array data initialization.
//! ² To allocate and deallocate an array.
//! ```
//!
pub use crateCev;