bounded_array/
bounded_array.rs1use zigzag_alloc::collections::bounded_array::ExBoundedArray;
2
3fn main() {
4 let mut tasks = ExBoundedArray::<u32, 16>::new();
5
6 tasks.push(10).expect("Buffer overflow");
7 tasks.push(20).expect("Buffer overflow");
8
9 let extra = [30, 40, 50];
10 if tasks.remaining() >= extra.len() {
11 tasks.push_slice(&extra).unwrap();
12 }
13
14 for task in tasks.iter() {
15 println!("Task ID: {}", task);
16 }
17
18 println!("Total len: {}/{}", tasks.len(), tasks.capacity());
19}