Skip to main content

vecdb/variants/eager/
readable.rs

1use crate::{ReadableVec, StoredVec};
2
3use super::EagerVec;
4
5impl<V> ReadableVec<V::I, V::T> for EagerVec<V>
6where
7    V: StoredVec,
8{
9    #[inline(always)]
10    fn collect_one_at(&self, index: usize) -> Option<V::T> {
11        self.0.collect_one_at(index)
12    }
13
14    #[inline(always)]
15    fn read_into_at(&self, from: usize, to: usize, buf: &mut Vec<V::T>) {
16        self.0.read_into_at(from, to, buf)
17    }
18
19    #[inline]
20    fn for_each_range_dyn_at(&self, from: usize, to: usize, f: &mut dyn FnMut(V::T)) {
21        self.0.for_each_range_dyn_at(from, to, f)
22    }
23
24    #[inline]
25    fn fold_range_at<B, F: FnMut(B, V::T) -> B>(&self, from: usize, to: usize, init: B, f: F) -> B
26    where
27        Self: Sized,
28    {
29        self.0.fold_range_at(from, to, init, f)
30    }
31
32    #[inline]
33    fn try_fold_range_at<B, E, F: FnMut(B, V::T) -> std::result::Result<B, E>>(
34        &self,
35        from: usize,
36        to: usize,
37        init: B,
38        f: F,
39    ) -> std::result::Result<B, E>
40    where
41        Self: Sized,
42    {
43        self.0.try_fold_range_at(from, to, init, f)
44    }
45}