pub struct StreamVersion(/* private fields */);Expand description
How many events a ceremony’s stream holds.
A stream that does not exist yet is at StreamVersion::EMPTY;
after that the version is the sequence of the last record, since
sequences start at 1 and are contiguous. A command is decided
against a version and appended with it as the expectation, which is
what lets a store refuse a write decided against a stream that has
since moved on.
Not a super::AuditSequence: a sequence names a record, and there
is no record for an empty stream.
Implementations§
Source§impl StreamVersion
impl StreamVersion
pub const fn new(value: u64) -> Self
Sourcepub fn from_sequence(sequence: AuditSequence) -> Self
pub fn from_sequence(sequence: AuditSequence) -> Self
The version a stream reaches once sequence is its last record.
pub fn value(self) -> u64
Sourcepub fn next(self) -> Self
pub fn next(self) -> Self
The version after one more event. Saturates rather than wrapping, as sequences do.
pub fn is_empty(self) -> bool
Trait Implementations§
Source§impl Clone for StreamVersion
impl Clone for StreamVersion
Source§fn clone(&self) -> StreamVersion
fn clone(&self) -> StreamVersion
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 StreamVersion
Source§impl Debug for StreamVersion
impl Debug for StreamVersion
Source§impl<'de> Deserialize<'de> for StreamVersion
impl<'de> Deserialize<'de> for StreamVersion
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for StreamVersion
Source§impl Hash for StreamVersion
impl Hash for StreamVersion
Source§impl Ord for StreamVersion
impl Ord for StreamVersion
Source§fn cmp(&self, other: &StreamVersion) -> Ordering
fn cmp(&self, other: &StreamVersion) -> 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
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialEq for StreamVersion
impl PartialEq for StreamVersion
Source§impl PartialOrd for StreamVersion
impl PartialOrd for StreamVersion
Source§impl Serialize for StreamVersion
impl Serialize for StreamVersion
impl StructuralPartialEq for StreamVersion
Auto Trait Implementations§
impl Freeze for StreamVersion
impl RefUnwindSafe for StreamVersion
impl Send for StreamVersion
impl Sync for StreamVersion
impl Unpin for StreamVersion
impl UnsafeUnpin for StreamVersion
impl UnwindSafe for StreamVersion
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