Skip to main content

migrate_chain

Macro migrate_chain 

Source
macro_rules! migrate_chain {
    ($first:ty $(=> $rest:ty)+) => { ... };
    (@grow [$pred:ty $(, $older:ty)*] => $new:ty $(=> $rest:ty)*) => { ... };
    (@grow [$($seen:ty),+]) => { ... };
}
Expand description

Generate the transitive closure of Upgrade impls for a schema chain.

Given adjacent MigrateFrom edges (typically from #[derive(Ix)] with migrate_from), this wires up every older-to-newer pair by composition — most importantly the direct jump from the oldest version to the newest.

// V2: MigrateFrom<V1>, V3: MigrateFrom<V2> already exist (derived).
ix_schema::migrate_chain!(V1 => V2 => V3);
// now: V1: Upgrade<V2>, V2: Upgrade<V3>, and V1: Upgrade<V3> (composed).
let v3: V3 = some_v1.upgrade();