Struct libzeropool_rs::sparse_array::SparseArray
source · [−]pub struct SparseArray<D: KeyValueDB, T: BorshSerialize + BorshDeserialize> {
pub db: D,
/* private fields */
}
Expand description
A persistent sparse array built on top of kvdb
Fields
db: D
Implementations
sourceimpl<T> SparseArray<MemoryDatabase, T> where
T: BorshSerialize + BorshDeserialize,
impl<T> SparseArray<MemoryDatabase, T> where
T: BorshSerialize + BorshDeserialize,
pub fn new_test() -> SparseArray<MemoryDatabase, T>
sourceimpl<D: KeyValueDB, T> SparseArray<D, T> where
D: KeyValueDB,
T: BorshSerialize + BorshDeserialize + 'static,
impl<D: KeyValueDB, T> SparseArray<D, T> where
D: KeyValueDB,
T: BorshSerialize + BorshDeserialize + 'static,
pub fn new(db: D) -> SparseArray<D, T>
pub fn get(&self, index: u64) -> Option<T>
pub fn iter(&self) -> SparseArrayIter<'_, T>ⓘNotable traits for SparseArrayIter<'a, T>impl<'a, T: BorshDeserialize> Iterator for SparseArrayIter<'a, T> type Item = (u64, T);
pub fn iter_slice<R>(&self, range: R) -> impl Iterator<Item = (u64, T)> + '_ where
R: RangeBounds<u64> + 'static,
pub fn set(&self, index: u64, data: &T)
pub fn remove(&self, index: u64)
pub fn remove_all_after(&self, index: u64)
pub fn count(&self) -> usize
pub fn set_multiple<'a, I>(&self, items: I) where
I: IntoIterator<Item = &'a (u64, T)>,
Auto Trait Implementations
impl<D, T> RefUnwindSafe for SparseArray<D, T> where
D: RefUnwindSafe,
T: RefUnwindSafe,
impl<D, T> Send for SparseArray<D, T> where
T: Send,
impl<D, T> Sync for SparseArray<D, T> where
T: Sync,
impl<D, T> Unpin for SparseArray<D, T> where
D: Unpin,
T: Unpin,
impl<D, T> UnwindSafe for SparseArray<D, T> where
D: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more