Skip to main content

FromAccount

Trait FromAccount 

Source
pub trait FromAccount<'a>: Sized {
    // Required method
    fn from_account(
        account: &'a AccountView,
        program_id: &Address,
    ) -> Result<Self, ProgramError>;
}
Expand description

Trait for types that can be constructed from an AccountView with validation.

Required Methods§

Source

fn from_account( account: &'a AccountView, program_id: &Address, ) -> Result<Self, ProgramError>

Construct this type from an account, performing all required validation.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<'a, I: FromAccount<'a> + HasView<'a>> FromAccount<'a> for Mut<I>

Source§

impl<'a, I: FromAccount<'a> + HasView<'a>> FromAccount<'a> for Signer<I>

Source§

impl<'a, T: Pod + FixedLayout + HopperLayout> FromAccount<'a> for Account<'a, T>

Source§

impl<'a, T: Pod + FixedLayout + HopperLayout> FromAccount<'a> for AccountMut<'a, T>