pub enum VersionCompatibility {
Full,
Degraded,
Incompatible,
}Expand description
Result of snapshot version compatibility analysis.
Returned by check_version to indicate whether a snapshot with a given
format version can be read by this build of Hexz. This enum enables
graceful handling of version mismatches with appropriate error messages.
§Variants
-
Full: Version is within
MIN_SUPPORTED_VERSION..=MAX_SUPPORTED_VERSIONand all features are supported. Proceed with normal operations. -
Degraded: Version is newer than
MAX_SUPPORTED_VERSIONbut forward compatibility rules allow partial reads with warnings. Unsupported features are ignored or substituted with defaults. (Not yet implemented; currently treated as Incompatible.) -
Incompatible: Version is outside the supported range and cannot be read. The user must upgrade Hexz (for newer snapshots) or migrate the snapshot (for older snapshots).
§Examples
use hexz_core::format::version::{check_version, VersionCompatibility};
let result = check_version(1);
assert_eq!(result, VersionCompatibility::Full);
let result = check_version(999);
assert_eq!(result, VersionCompatibility::Incompatible);
assert!(!result.is_compatible());Variants§
Full
Fully supported version with all features available.
Degraded
Newer version with partial support (warnings emitted, some features unavailable).
This variant is reserved for future forward compatibility modes. Currently, all versions outside the supported range are marked as Incompatible.
Incompatible
Incompatible version that cannot be read (too old or too new).
Implementations§
Source§impl VersionCompatibility
impl VersionCompatibility
Sourcepub fn is_compatible(&self) -> bool
pub fn is_compatible(&self) -> bool
Tests whether the snapshot can be read with this compatibility status.
Returns true for Full and
Degraded compatibility, indicating
that read operations can proceed (possibly with warnings). Returns false
for Incompatible, indicating that
the snapshot must be rejected.
§Returns
true: Snapshot can be opened (possibly with limited functionality)false: Snapshot cannot be opened (hard error)
§Examples
use hexz_core::format::version::{check_version, VersionCompatibility};
let compat = check_version(1);
if compat.is_compatible() {
println!("Snapshot can be read");
} else {
eprintln!("Snapshot is incompatible");
}Trait Implementations§
Source§impl Clone for VersionCompatibility
impl Clone for VersionCompatibility
Source§fn clone(&self) -> VersionCompatibility
fn clone(&self) -> VersionCompatibility
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for VersionCompatibility
impl Debug for VersionCompatibility
Source§impl Display for VersionCompatibility
impl Display for VersionCompatibility
Source§impl PartialEq for VersionCompatibility
impl PartialEq for VersionCompatibility
impl Copy for VersionCompatibility
impl Eq for VersionCompatibility
impl StructuralPartialEq for VersionCompatibility
Auto Trait Implementations§
impl Freeze for VersionCompatibility
impl RefUnwindSafe for VersionCompatibility
impl Send for VersionCompatibility
impl Sync for VersionCompatibility
impl Unpin for VersionCompatibility
impl UnsafeUnpin for VersionCompatibility
impl UnwindSafe for VersionCompatibility
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more