Skip to main content

Module modifier

Module modifier 

Source
Expand description

Modifier-style composable account wrappers.

Account constraints as nested type wrappers that compose at compile time. Each wrapper adds one constraint and delegates the rest to the inner type.

Signer<Mut<Account<'a, Vault>>>  -- verified signer + writable + typed overlay
Mut<Account<'a, Vault>>          -- verified writable + typed overlay
Account<'a, Vault>               -- verified owner + disc + layout_id
ReadOnly<'a, Vault>              -- foreign account, read-only

§Design Principles

  • Zero runtime cost: wrapper structs are transparent or ZST stacks
  • Each modifier validates exactly one property
  • Inner value is accessible via .inner() or Deref
  • All validation happens in from_account() – if you have the type, it’s valid

Structs§

Account
A typed, owner-validated account (immutable).
AccountMut
A typed, owner-validated account (mutable).
Mut
Writable wrapper – validates that the account is writable.
Signer
Signer wrapper – validates that the account is a signer.

Traits§

FromAccount
Trait for types that can be constructed from an AccountView with validation.
HasView
Helper trait for types that hold an &AccountView.
HopperLayout
Trait implemented by hopper_layout! types providing layout metadata.