Trait mango_v4::accounts_zerocopy::LoadZeroCopyRef
source · pub trait LoadZeroCopyRef {
// Required methods
fn load<T: ZeroCopy + Owner>(&self) -> Result<Ref<'_, T>>;
fn load_fully_unchecked<T: ZeroCopy + Owner>(&self) -> Result<Ref<'_, T>>;
}
Required Methods§
sourcefn load<T: ZeroCopy + Owner>(&self) -> Result<Ref<'_, T>>
fn load<T: ZeroCopy + Owner>(&self) -> Result<Ref<'_, T>>
Using AccountLoader forces a AccountInfo.clone() and then binds the loaded lifetime to the AccountLoader’s lifetime. This function avoids both. It checks the account owner and discriminator, then casts the data.
sourcefn load_fully_unchecked<T: ZeroCopy + Owner>(&self) -> Result<Ref<'_, T>>
fn load_fully_unchecked<T: ZeroCopy + Owner>(&self) -> Result<Ref<'_, T>>
Same as load(), but doesn’t check the discriminator or owner.