pub enum AccountFieldPatch {
Lamports(u64),
Owner(Pubkey),
DataAt {
offset: usize,
data: Vec<u8>,
},
Lifecycle {
mode: AccountMode,
slot: Slot,
},
DataLen(usize),
}Expand description
A bounded account-image patch.
Variants§
Lamports(u64)
Replaces the lamport balance.
Owner(Pubkey)
Replaces the owner.
DataAt
Writes bytes starting at offset, extending the account data if needed.
Lifecycle
Replaces the account lifecycle.
DataLen(usize)
Resizes the data buffer to an exact length, zero-filling when growing.
Implementations§
Source§impl AccountFieldPatch
impl AccountFieldPatch
Sourcepub fn apply(
self,
account: &mut AccountSharedData,
) -> Result<(), AccountPatchError>
pub fn apply( self, account: &mut AccountSharedData, ) -> Result<(), AccountPatchError>
Applies this patch to account.
The account methods mark dirtiness and preserve the writable invariants. Invalid mode and slot transitions leave the account unchanged and return their transition context.
Sourcepub fn sequence(account: OwnedAccount) -> Vec<Self>
pub fn sequence(account: OwnedAccount) -> Vec<Self>
Decomposes an owned account into the ordered sequence of patches that
reconstruct its non-flag fields: lamports, lifecycle, owner, the exact
data length, then the data in MAX_DATA_CHUNK_SIZE-sized chunks.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AccountFieldPatch
impl RefUnwindSafe for AccountFieldPatch
impl Send for AccountFieldPatch
impl Sync for AccountFieldPatch
impl Unpin for AccountFieldPatch
impl UnsafeUnpin for AccountFieldPatch
impl UnwindSafe for AccountFieldPatch
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