boseiju/utils/
containers.rs1#[derive(serde::Serialize, serde::Deserialize)]
2#[derive(Debug, Clone, PartialEq, Eq)]
3pub struct HeapArrayVec<T, const CAP: usize> {
4 inner: Box<arrayvec::ArrayVec<T, CAP>>,
5}
6
7impl<T, const CAP: usize> HeapArrayVec<T, CAP> {
8 pub fn new() -> Self {
9 let result = Box::new(arrayvec::ArrayVec::new_const());
18
19 Self { inner: result }
20 }
21}
22
23impl<T, const CAP: usize> std::ops::Deref for HeapArrayVec<T, CAP> {
24 type Target = arrayvec::ArrayVec<T, CAP>;
25 fn deref(&self) -> &Self::Target {
26 self.inner.deref()
27 }
28}
29
30impl<T, const CAP: usize> std::ops::DerefMut for HeapArrayVec<T, CAP> {
31 fn deref_mut(&mut self) -> &mut Self::Target {
32 self.inner.deref_mut()
33 }
34}
35
36impl<T, const CAP: usize> crate::utils::DummyInit for HeapArrayVec<T, CAP> {
37 fn dummy_init() -> Self {
38 Self::new()
39 }
40}