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