pub trait Sysvar: SysvarId + Default + Sized + Serialize + DeserializeOwned {
    // Provided methods
    fn size_of() -> usize { ... }
    fn from_account_info(
        account_info: &AccountInfo<'_>
    ) -> Result<Self, ProgramError> { ... }
    fn to_account_info(&self, account_info: &mut AccountInfo<'_>) -> Option<()> { ... }
    fn get() -> Result<Self, ProgramError> { ... }
}

Provided Methods§

source

fn size_of() -> usize

source

fn from_account_info( account_info: &AccountInfo<'_> ) -> Result<Self, ProgramError>

Deserializes a sysvar from its AccountInfo.

Errors

If account_info does not have the same ID as the sysvar this function returns ProgramError::InvalidArgument.

source

fn to_account_info(&self, account_info: &mut AccountInfo<'_>) -> Option<()>

source

fn get() -> Result<Self, ProgramError>

Implementors§