pub struct MigrationPlan<'a, const N: usize> {
pub policy: MigrationPolicy,
pub steps: [MigrationStep<'a>; N],
pub step_count: usize,
pub old_size: usize,
pub new_size: usize,
pub copy_bytes: usize,
pub zero_bytes: usize,
pub backward_readable: bool,
}Expand description
A generated migration plan between two layout versions.
Contains ordered steps to transform V(N) account data to V(N+1).
All steps are stack-allocated to stay no_std/no_alloc.
Fields§
§policy: MigrationPolicy§steps: [MigrationStep<'a>; N]§step_count: usize§old_size: usizeOld total size.
new_size: usizeNew total size.
copy_bytes: usizeHow many bytes must be copied from old to new.
zero_bytes: usizeHow many bytes are newly zero-initialized.
backward_readable: boolWhether V(N) code can still parse V(N+1) accounts (prefix-compatible).
Implementations§
Source§impl<'a, const N: usize> MigrationPlan<'a, N>
impl<'a, const N: usize> MigrationPlan<'a, N>
Sourcepub fn generate(older: &'a LayoutManifest, newer: &'a LayoutManifest) -> Self
pub fn generate(older: &'a LayoutManifest, newer: &'a LayoutManifest) -> Self
Generate a migration plan from two manifests.
Analyzes the field-level diff and produces an ordered list of concrete steps (copy prefix, zero-init new fields, update header).
Sourcepub fn requires_data_copy(&self) -> bool
pub fn requires_data_copy(&self) -> bool
Whether this plan requires data movement (non-trivial migration).
Sourcepub fn step(&self, i: usize) -> Option<&MigrationStep<'a>>
pub fn step(&self, i: usize) -> Option<&MigrationStep<'a>>
Get step by index.
Sourcepub fn for_each_step<F: FnMut(usize, &MigrationStep<'a>)>(&self, f: F)
pub fn for_each_step<F: FnMut(usize, &MigrationStep<'a>)>(&self, f: F)
Iterator-style: iterate steps with index.
Trait Implementations§
Auto Trait Implementations§
impl<'a, const N: usize> Freeze for MigrationPlan<'a, N>
impl<'a, const N: usize> RefUnwindSafe for MigrationPlan<'a, N>
impl<'a, const N: usize> Send for MigrationPlan<'a, N>
impl<'a, const N: usize> Sync for MigrationPlan<'a, N>
impl<'a, const N: usize> Unpin for MigrationPlan<'a, N>
impl<'a, const N: usize> UnsafeUnpin for MigrationPlan<'a, N>
impl<'a, const N: usize> UnwindSafe for MigrationPlan<'a, N>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more