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§
Source§impl<T> SparseArray<InMemory, T>where
T: BorshSerialize + BorshDeserialize,
impl<T> SparseArray<InMemory, T>where
T: BorshSerialize + BorshDeserialize,
pub fn new_test() -> SparseArray<MemoryDatabase, T>
Source§impl<D, T> SparseArray<D, T>
impl<D, T> SparseArray<D, T>
pub fn new(db: D) -> SparseArray<D, T>
pub fn get(&self, index: u64) -> Option<T>
pub fn iter(&self) -> SparseArrayIter<'_, 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> Freeze for SparseArray<D, T>where
D: Freeze,
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>
impl<D, T> UnwindSafe for SparseArray<D, T>where
D: UnwindSafe,
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<Out, S> FromSeed<S> for Outwhere
S: SeedBoxGen<Out>,
impl<Out, S> FromSeed<S> for Outwhere
S: SeedBoxGen<Out>,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more