Skip to main content

InterfaceAccountLayout

Trait InterfaceAccountLayout 

Source
pub trait InterfaceAccountLayout: LayoutContract {
    type Interface: InterfaceSpec;

    // Provided method
    fn validate_interface_account(
        view: &AccountView,
    ) -> Result<(), ProgramError> { ... }
}
Expand description

Hopper layout whose owner may be any program in an interface set.

This is the generic counterpart to token-specific interface helpers. Use it for Hopper-header layouts shared across compatible programs:

pub struct VaultPrograms;
impl InterfaceSpec for VaultPrograms {
    const IDS: &'static [Address] = &[PROGRAM_A, PROGRAM_B];
}

impl InterfaceAccountLayout for SharedVault {
    type Interface = VaultPrograms;
}

Required Associated Types§

Source

type Interface: InterfaceSpec

The owner/program set accepted for this layout.

Provided Methods§

Source

fn validate_interface_account(view: &AccountView) -> Result<(), ProgramError>

Validate this interface account’s bytes after owner-set validation.

Concrete Hopper layouts keep the default: validate and borrow through the cross-program loader, which checks discriminator, layout id, and size without requiring the owner to be the executing program. Marker interface layouts can override this to accept a bounded set of concrete layout variants while still using the same InterfaceAccount wrapper.

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§