Skip to main content

Crate hopper_macros

Crate hopper_macros 

Source
Expand description

§Hopper Macros (Declarative)

Support infrastructure, not the main public entry. These macro_rules! macros generate layout structure, field metadata, and validation primitives at compile time. They are deliberately limited to structure generation: no hidden runtime logic, no surprise control flow, no validation engines.

Programs that want richer DX should enable the proc-macros feature and reach for #[hopper::state], #[hopper::context], and #[hopper::program] in hopper-macros-proc. Programs that prefer a zero-tool-chain authoring path can use these declarative macros directly, both paths lower to the same runtime.

§Topical index

SectionMacros
Layouthopper_layout!
Validationhopper_check!, hopper_error!, hopper_require!
Lifecyclehopper_init!, hopper_close!
Dispatchhopper_register_discs!
PDAhopper_verify_pda!
Invariantshopper_invariant!
Manifesthopper_manifest!
Segmentshopper_segment!
Pipelineshopper_validate!
Virtual statehopper_virtual!
Compat / ABIhopper_assert_compatible!, hopper_assert_fingerprint!, const_assert_pod!
Cross-programhopper_interface!
Account structshopper_accounts!

Every macro below is #[macro_export]ed and usable from the root of the hopper-macros crate regardless of the section banner it lives under. The banners exist only to help readers navigate the file.

Re-exports§

pub use hopper_core;
pub use hopper_runtime;
pub use hopper_schema;
pub use hopper_system;

Macros§

const_assert_pod
Compile-time assertion for safe manual Pod implementations.
hopper_accounts
Generate a typed instruction context struct with validated account parsing.
hopper_assert_compatible
Assert that two layout versions have compatible fingerprints.
hopper_assert_fingerprint
Assert that a layout’s fingerprint matches an expected value.
hopper_check
Composable account constraint checking.
hopper_close
Safely close an account with sentinel protection.
hopper_error
Generate sequential error codes.
hopper_init
Initialize an account: allocate, assign, zero-init, write header.
hopper_interface
Declare a cross-program interface view.
hopper_invariant
Invariant checking macro.
hopper_layout
Define a zero-copy account layout.
hopper_manifest
Generate a layout manifest for schema tooling.
hopper_register_discs
Discriminator registry – compile-time uniqueness enforcement.
hopper_require
Require a condition, returning a custom error if false.
hopper_segment
Declare a segmented account with typed segments.
hopper_validate
Build a validation pipeline declaratively.
hopper_verify_pda
PDA verification with BUMP_OFFSET optimization.
hopper_virtual
Declare a multi-account virtual state mapping.