macro_rules! layout_migrations {
( $layout:ty = [ $( $edge:expr ),+ $(,)? ] $(,)? ) => { ... };
}Expand description
Compose a layout’s LayoutMigration::MIGRATIONS chain from a list
of #[hopper::migrate]-emitted edge constants.
ⓘ
#[hopper::migrate(from = 1, to = 2)]
pub fn vault_v1_to_v2(body: &mut [u8]) -> ProgramResult { Ok(()) }
hopper::layout_migrations! {
Vault = [VAULT_V1_TO_V2_EDGE, VAULT_V2_TO_V3_EDGE],
}Emits impl LayoutMigration for Vault { const MIGRATIONS = .. }.
Each list entry must evaluate to a
MigrationEdge. typically the
<UPPER_SNAKE_FN_NAME>_EDGE constant that
#[hopper::migrate] emits alongside each migration function.
Chain continuity (every adjacent pair must satisfy
a.to_epoch == b.from_epoch) is enforced at runtime by
apply_pending_migrations.