forked from Deuxfleurs/garage
Add must_use to some CRDT functions
This commit is contained in:
parent
b76d0580a0
commit
c7d5c73244
3 changed files with 3 additions and 1 deletions
|
@ -63,6 +63,7 @@ where
|
|||
///
|
||||
/// However extracting the mutator on its own and only sending that on the network is very
|
||||
/// interesting as it is much smaller than the whole map.
|
||||
#[must_use = "CRDT mutators are meant to be merged into a CRDT and not ignored."]
|
||||
pub fn update_mutator(&self, k: K, new_v: V) -> Self {
|
||||
let new_vals = match self.vals.binary_search_by(|(k2, _, _)| k2.cmp(&k)) {
|
||||
Ok(i) => {
|
||||
|
|
|
@ -33,6 +33,7 @@ where
|
|||
/// This can be used to build a delta-mutator:
|
||||
/// when merged with another map, the value will be added or CRDT-merged if a previous
|
||||
/// value already exists.
|
||||
#[must_use = "CRDT mutators are meant to be merged into a CRDT and not ignored."]
|
||||
pub fn put_mutator(k: K, v: V) -> Self {
|
||||
Self { vals: vec![(k, v)] }
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
//! counter. Alice does +1 on her copy, she reads 1. Bob does +3 on his copy, he reads 3. Now,
|
||||
//! it is easy to merge their counters, order does not count: we always get 4.
|
||||
//!
|
||||
//! Learn more about CRDT [on Wikipedia](https://en.wikipedia.org/wiki/Conflict-free_replicated_data_type)
|
||||
//! Learn more about CRDTs [on Wikipedia](https://en.wikipedia.org/wiki/Conflict-free_replicated_data_type)
|
||||
|
||||
mod bool;
|
||||
#[allow(clippy::module_inception)]
|
||||
|
|
Loading…
Reference in a new issue