pub struct FormatVersion {
pub major: u32,
pub minor: u32,
}Expand description
A parsed MAJOR.MINOR format version.
§Compatibility policy
The version gate used to be string equality, which meant a v0.1 reader refused a v0.2 file even when the only change was an added record kind it already knew how to skip. That makes every additive change a breaking one, which defeats the point of having a minor version at all. The rule is now:
- Same major, any minor → readable. Minor bumps are
additive-only by contract: new record kinds, new optional fields.
An older reader skips what it does not recognise (see
AntReader::next_record) and still verifies the trailer, so it gets a truthful subset rather than an error. - Unknown record kinds are skipped, not fatal — within the same major. They are still hashed, so integrity still holds.
- A different major → rejected, explicitly. A major bump is reserved for changes an old reader would silently MISREAD: changed field meanings, a different container framing, a removed or repurposed kind. Refusing is the only safe answer.
- A newer minor is not an error, but it is a known unknown.
AntReader::minor_aheadreports it so a caller can warn that the file may carry records this build did not surface.
Writers must therefore never change the meaning of an existing field within a major. If a change cannot be expressed additively, it needs a major bump.
Fields§
§major: u32Major: different majors are mutually unreadable.
minor: u32Minor: additive-only within a major.
Implementations§
Source§impl FormatVersion
impl FormatVersion
Sourcepub const CURRENT: FormatVersion
pub const CURRENT: FormatVersion
The version this build reads and writes.
Sourcepub fn readable_by_current(&self) -> bool
pub fn readable_by_current(&self) -> bool
Can this build read a file written at self?
Trait Implementations§
Source§impl Clone for FormatVersion
impl Clone for FormatVersion
Source§fn clone(&self) -> FormatVersion
fn clone(&self) -> FormatVersion
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for FormatVersion
Source§impl Debug for FormatVersion
impl Debug for FormatVersion
Source§impl Display for FormatVersion
impl Display for FormatVersion
impl Eq for FormatVersion
Source§impl Ord for FormatVersion
impl Ord for FormatVersion
Source§fn cmp(&self, other: &FormatVersion) -> Ordering
fn cmp(&self, other: &FormatVersion) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for FormatVersion
impl PartialEq for FormatVersion
Source§impl PartialOrd for FormatVersion
impl PartialOrd for FormatVersion
impl StructuralPartialEq for FormatVersion
Auto Trait Implementations§
impl Freeze for FormatVersion
impl RefUnwindSafe for FormatVersion
impl Send for FormatVersion
impl Sync for FormatVersion
impl Unpin for FormatVersion
impl UnsafeUnpin for FormatVersion
impl UnwindSafe for FormatVersion
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