Struct version_track::Version
source · pub struct Version { /* private fields */ }
Expand description
Tracks the changing state of the rebase file
Implementations§
source§impl Version
impl Version
sourcepub const fn sentinel() -> Self
pub const fn sentinel() -> Self
Creates a sentinel Self, that is useful as an initial non-version for caching. Any changes to this
version will reset the internal state to a new value. Internally, this uses a Uuid with the maximum valid
value, and an increment of usize::MAX
.
See SENTINEL_VERSION
for a constant sentinel value.
sourcepub fn increment(&mut self)
pub fn increment(&mut self)
Increment the internal internal version, if the increment overflows, then the internal Uuid is recreated with a new value, and the increment is set to 0.
See Self::increment_wrap
for a version that does not update the internal Uuid on overflow.
sourcepub fn increment_wrap(&mut self)
pub fn increment_wrap(&mut self)
Increment the internal internal version, if the increment overflows, the increment resets to 0. This allows the internal Uuid to remain stable, and reusing older increments are okay.
See Self::increment
for a version that refreshes the internal Uuid on overflow.
sourcepub fn alike(&self, other: &Self) -> bool
pub fn alike(&self, other: &Self) -> bool
Check if the internal Uuid is the same for this version and another. This is useful for checking if the state being treated by this instance is the same as another.
Note that using Self::reset
or Self::increment
can update the internal Uuid, and result in this value
returning false.