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
use crate::error::Error;
use crate::platform::{Map, MapType};
pub struct Array<V: Copy + Default + Sized> {
map: Map<u32, V>,
}
impl<V: Copy + Default + Sized> Array<V> {
pub fn create(entries: u32) -> Result<Self, Error> {
Ok(Self {
map: Map::create(MapType::Array, entries)?,
})
}
pub fn get(&self, el: u32) -> Result<V, Error> {
self.map.get(&el)
}
pub fn set(&self, el: u32, val: V) -> Result<(), Error> {
self.map.set(&el, &val)
}
pub fn get_identifier(&self) -> u32 {
self.map.get_identifier()
}
}