pub enum CompatibilityVerdict {
Identical,
WireCompatible,
AppendSafe,
MigrationRequired,
Incompatible,
}Expand description
Unified compatibility verdict between two layout versions.
Replaces ad-hoc boolean checks with a single, ranked classification. The ordering is from least disruptive to most disruptive.
Variants§
Identical
Layouts are byte-identical (same layout_id).
WireCompatible
Same wire layout (field count, sizes, offsets, types all match)
but layout_id differs. Semantic metadata changed (e.g. field
intent, layout name). Safe to read, no migration needed.
AppendSafe
Same discriminator, old field prefix intact in new layout. Old readers can still parse new accounts (they ignore the tail). Covers both strict append (new fields only at the end) and prefix-preserving changes. No forced migration required.
MigrationRequired
Breaking change: field types changed, fields removed, or prefix altered. Full migration required before deploying new code.
Incompatible
Different discriminators. These are fundamentally different types.
Implementations§
Source§impl CompatibilityVerdict
impl CompatibilityVerdict
Sourcepub fn between(older: &LayoutManifest, newer: &LayoutManifest) -> Self
pub fn between(older: &LayoutManifest, newer: &LayoutManifest) -> Self
Compute the verdict for a version transition.
Sourcepub const fn is_backward_readable(self) -> bool
pub const fn is_backward_readable(self) -> bool
Whether old readers can still parse accounts written by the new layout.
Sourcepub const fn requires_migration(self) -> bool
pub const fn requires_migration(self) -> bool
Whether a migration instruction is required.
Sourcepub fn refine_with_roles<const N: usize>(
self,
report: &SegmentMigrationReport<N>,
) -> Self
pub fn refine_with_roles<const N: usize>( self, report: &SegmentMigrationReport<N>, ) -> Self
Refine a verdict using segment-role information.
The base between() is field-level only. When a segmented account
has role metadata, this method can soften or escalate:
-
A
MigrationRequiredverdict is softened toAppendSafewhen all changed segments are clearable or rebuildable (Cache, Index, Journal). Core / Audit / Extension changes stay breaking. -
An
AppendSafeverdict is escalated toMigrationRequiredwhen any modified segment is immutable-after-init (Audit).
Trait Implementations§
Source§impl Clone for CompatibilityVerdict
impl Clone for CompatibilityVerdict
Source§fn clone(&self) -> CompatibilityVerdict
fn clone(&self) -> CompatibilityVerdict
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CompatibilityVerdict
impl Debug for CompatibilityVerdict
Source§impl Display for CompatibilityVerdict
impl Display for CompatibilityVerdict
Source§impl PartialEq for CompatibilityVerdict
impl PartialEq for CompatibilityVerdict
Source§fn eq(&self, other: &CompatibilityVerdict) -> bool
fn eq(&self, other: &CompatibilityVerdict) -> bool
self and other values to be equal, and is used by ==.