eventually_core/versioning.rs
1//! Contains support for Optimistic Concurrency Control through
2//! Versioning.
3
4/// Data type that carries a version for Optimistic Concurrency Control.
5pub trait Versioned {
6 /// Current version of the data.
7 fn version(&self) -> u32;
8}
9
10impl<T> Versioned for Option<T>
11where
12 T: Versioned,
13{
14 #[inline]
15 fn version(&self) -> u32 {
16 self.as_ref().map(Versioned::version).unwrap_or_default()
17 }
18}