pub trait ExternalZeroCopy {
type View<'a>;
const OWNER: Option<Address> = None;
const DISCRIMINATOR: Option<&'static [u8]> = None;
const MIN_LEN: usize = 0;
// Required method
fn view<'a>(data: Ref<'a, [u8]>) -> Result<Self::View<'a>, ProgramError>;
// Provided method
fn validate(view: &AccountView<'_>) -> ProgramResult { ... }
}Expand description
Validation contract for known non-Hopper account layouts.
Hopper-owned layouts use Hopper headers and Account.
Known foreign accounts usually do not. Implement this trait on a marker or
adapter type to validate owner, fixed byte prefix/discriminator, minimum
length, version bytes, oracle freshness gates, or any other external
invariant before binding an ExternalAccount.
Provided Associated Constants§
Sourceconst DISCRIMINATOR: Option<&'static [u8]> = None
const DISCRIMINATOR: Option<&'static [u8]> = None
Optional byte prefix/discriminator at offset 0.
Required Associated Types§
Required Methods§
Provided Methods§
Sourcefn validate(view: &AccountView<'_>) -> ProgramResult
fn validate(view: &AccountView<'_>) -> ProgramResult
Validate this external account. Override for multi-owner layouts, versioned dispatch, or custom invariants.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".