pub trait Sysvar: Sized + Default {
// Provided method
fn get() -> Result<Self, ProgramError> { ... }
}
Expand description
Interface for loading a sysvar.
Provided Methods§
Sourcefn get() -> Result<Self, ProgramError>
fn get() -> Result<Self, ProgramError>
Load the sysvar directly from the runtime.
This is the preferred way to load a sysvar. Calling this method does not incur any deserialization overhead, and does not require the sysvar account to be passed to the program.
Not all sysvars support this method. If not, it returns
ProgramError::UnsupportedSysvar
.
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.