pub enum ExpectedVersion {
Any,
Exists,
Empty,
Exact(u64),
}Expand description
The expected version before the event is inserted.
Variants§
Any
Accept any version, whether the stream/partition exists or not.
Exists
The stream/partition must exist (have at least one event).
Empty
The stream/partition must be empty (have no events yet).
Exact(u64)
The stream/partition must be exactly at this version.
Implementations§
Source§impl ExpectedVersion
impl ExpectedVersion
pub fn from_next_version(version: u64) -> Self
pub fn into_next_version(self) -> Option<u64>
Sourcepub fn gap_from(self, current: CurrentVersion) -> VersionGap
pub fn gap_from(self, current: CurrentVersion) -> VersionGap
Calculate the gap between expected and current version. Returns VersionGap::None if the expectation is satisfied.
Sourcepub fn is_satisfied_by(self, current: CurrentVersion) -> bool
pub fn is_satisfied_by(self, current: CurrentVersion) -> bool
Check if the current version satisfies the expectation
Trait Implementations§
Source§impl Clone for ExpectedVersion
impl Clone for ExpectedVersion
Source§fn clone(&self) -> ExpectedVersion
fn clone(&self) -> ExpectedVersion
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ExpectedVersion
impl Debug for ExpectedVersion
Source§impl Default for ExpectedVersion
impl Default for ExpectedVersion
Source§fn default() -> ExpectedVersion
fn default() -> ExpectedVersion
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for ExpectedVersion
impl<'de> Deserialize<'de> for ExpectedVersion
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
Source§impl Display for ExpectedVersion
impl Display for ExpectedVersion
Source§impl FromStr for ExpectedVersion
impl FromStr for ExpectedVersion
Source§impl PartialEq for ExpectedVersion
impl PartialEq for ExpectedVersion
Source§impl Serialize for ExpectedVersion
impl Serialize for ExpectedVersion
impl Copy for ExpectedVersion
impl Eq for ExpectedVersion
impl StructuralPartialEq for ExpectedVersion
Auto Trait Implementations§
impl Freeze for ExpectedVersion
impl RefUnwindSafe for ExpectedVersion
impl Send for ExpectedVersion
impl Sync for ExpectedVersion
impl Unpin for ExpectedVersion
impl UnwindSafe for ExpectedVersion
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