Skip to main content

AccountFieldPatch

Enum AccountFieldPatch 

Source
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.

Fields

§offset: usize

Byte offset into the current data buffer.

§data: Vec<u8>

Bytes to write.

§

Lifecycle

Replaces the account lifecycle.

Fields

§mode: AccountMode

Requested lifecycle mode.

§slot: Slot

Requested lifecycle slot.

§

DataLen(usize)

Resizes the data buffer to an exact length, zero-filling when growing.

Implementations§

Source§

impl AccountFieldPatch

Source

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.

Source

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§

Source§

impl Debug for AccountFieldPatch

Concise, log-friendly rendering: scalar fields show their value, DataAt shows only offset+len (never the raw bytes).

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.