Skip to main content

AccountFields

Trait AccountFields 

Source
pub trait AccountFields {
    type Layout;

    // Required method
    fn write(self, layout: &mut Self::Layout) -> ProgramResult;
}
Expand description

Values that can populate a layout through an existing mutable borrow.

Generated <State>Fields types implement this trait. Application crates may also implement it for their own inputs, including fallible validation before writing. This trait grants no account access: ownership, layout, write policy, and borrow checks belong to the caller acquiring the mutable layout.

An error does not undo writes already made by an implementation. Propagate errors to the instruction boundary to obtain transaction rollback on Solana.

Required Associated Types§

Required Methods§

Source

fn write(self, layout: &mut Self::Layout) -> ProgramResult

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§