pub struct Versioned<Data>where
Data: Clone,{ /* private fields */ }
Expand description
Track data change by version.
For variable with interior mutability, such as those contain Arc<Mutex<_>>
or AtomicU64
,
a version
is used to track changes.
Every update that is made to it increments the version
by 1.
The inner data
is an Arc
thus Clone
would be cheap enough.
Caveat: an instance will see changes made on another clone, since they reference the same data, until an update-by-replace is made.
Implementations§
Trait Implementations§
source§impl<Data> MessageSummary<Versioned<Data>> for Versioned<Data>where
Data: Clone + MessageSummary<Data>,
impl<Data> MessageSummary<Versioned<Data>> for Versioned<Data>where Data: Clone + MessageSummary<Data>,
source§impl<Data> PartialEq<Versioned<Data>> for Versioned<Data>where
Data: Clone,
impl<Data> PartialEq<Versioned<Data>> for Versioned<Data>where Data: Clone,
source§impl<Data, U> Updatable<U> for Versioned<Data>where
Data: Clone,
U: Update<Data>,
impl<Data, U> Updatable<U> for Versioned<Data>where Data: Clone, U: Update<Data>,
If U
is an Update
, i.e. U.apply(Versioned<Data>)
,
then install a method update()
to Versioned<Data>
: Versioned<Data>.update(U)
.
impl<Data> Eq for Versioned<Data>where Data: Clone,
Auto Trait Implementations§
impl<Data> RefUnwindSafe for Versioned<Data>where Data: RefUnwindSafe,
impl<Data> Send for Versioned<Data>where Data: Send + Sync,
impl<Data> Sync for Versioned<Data>where Data: Send + Sync,
impl<Data> Unpin for Versioned<Data>
impl<Data> UnwindSafe for Versioned<Data>where Data: RefUnwindSafe,
Blanket Implementations§
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.