pub struct AccountSeqLock { /* private fields */ }Expand description
Read wrapper that retries borrowed account reads when a concurrent publish changes the backing image.
Implementations§
Source§impl AccountSeqLock
impl AccountSeqLock
Sourcepub fn new(account: AccountSharedData) -> Self
pub fn new(account: AccountSharedData) -> Self
Creates a read lock with the sequence that matches the current account view.
Sourcepub fn read<F, R>(&mut self, reader: F) -> Rwhere
F: Fn(&AccountSharedData) -> R,
pub fn read<F, R>(&mut self, reader: F) -> Rwhere
F: Fn(&AccountSharedData) -> R,
Runs reader against a stable account image.
For borrowed accounts, the sequence is checked after the read. If a writer published a new image meanwhile, the account view is reset to that active image and the read is retried.
Auto Trait Implementations§
impl Freeze for AccountSeqLock
impl RefUnwindSafe for AccountSeqLock
impl Send for AccountSeqLock
impl Sync for AccountSeqLock
impl Unpin for AccountSeqLock
impl UnsafeUnpin for AccountSeqLock
impl UnwindSafe for AccountSeqLock
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