pub struct StorableAccountsWithHashesAndWriteVersions<'a: 'b, 'b, T: ReadableAccount + Sync + 'b, U: StorableAccounts<'a, T>, V: Borrow<AccountHash>> { /* private fields */ }
Expand description
Goal is to eliminate copies and data reshaping given various code paths that store accounts. This struct contains what is needed to store accounts to a storage
- account & pubkey (StorableAccounts)
- hash per account (Maybe in StorableAccounts, otherwise has to be passed in separately)
- write version per account (Maybe in StorableAccounts, otherwise has to be passed in separately)
Implementations§
source§impl<'a: 'b, 'b, T: ReadableAccount + Sync + 'b, U: StorableAccounts<'a, T>, V: Borrow<AccountHash>> StorableAccountsWithHashesAndWriteVersions<'a, 'b, T, U, V>
impl<'a: 'b, 'b, T: ReadableAccount + Sync + 'b, U: StorableAccounts<'a, T>, V: Borrow<AccountHash>> StorableAccountsWithHashesAndWriteVersions<'a, 'b, T, U, V>
sourcepub fn new_with_hashes_and_write_versions(
accounts: &'b U,
hashes: Vec<V>,
write_versions: Vec<StoredMetaWriteVersion>,
) -> Self
pub fn new_with_hashes_and_write_versions( accounts: &'b U, hashes: Vec<V>, write_versions: Vec<StoredMetaWriteVersion>, ) -> Self
used when accounts does NOT contains hash or write version In this case, hashes and write_versions have to be passed in separately and zipped together.
sourcepub fn get(
&self,
index: usize,
) -> (Option<&T>, &Pubkey, &AccountHash, StoredMetaWriteVersion)
pub fn get( &self, index: usize, ) -> (Option<&T>, &Pubkey, &AccountHash, StoredMetaWriteVersion)
get all account fields at ‘index’
sourcepub fn account(&self, index: usize) -> Option<&T>
pub fn account(&self, index: usize) -> Option<&T>
None if account at index has lamports == 0 Otherwise, Some(account) This is the only way to access the account.
pub fn is_empty(&self) -> bool
Auto Trait Implementations§
impl<'a, 'b, T, U, V> Freeze for StorableAccountsWithHashesAndWriteVersions<'a, 'b, T, U, V>
impl<'a, 'b, T, U, V> RefUnwindSafe for StorableAccountsWithHashesAndWriteVersions<'a, 'b, T, U, V>
impl<'a, 'b, T, U, V> Send for StorableAccountsWithHashesAndWriteVersions<'a, 'b, T, U, V>where
V: Send,
impl<'a, 'b, T, U, V> Sync for StorableAccountsWithHashesAndWriteVersions<'a, 'b, T, U, V>where
V: Sync,
impl<'a, 'b, T, U, V> Unpin for StorableAccountsWithHashesAndWriteVersions<'a, 'b, T, U, V>where
V: Unpin,
impl<'a, 'b, T, U, V> UnwindSafe for StorableAccountsWithHashesAndWriteVersions<'a, 'b, T, U, V>
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<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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