pub struct OneWayBoolean {
pub flag: bool,
}Expand description
A boolean flag that, once true, can never revert to false
§Examples
Example usage, including demonstrating some properties:
use cvrdt_exposition::{Grow, OneWayBoolean};
let mut x = OneWayBoolean::new(false);
x.add(());
assert_eq!(x.payload(), true);
assert_eq!(x.query(&()), true);
for payload in vec![true, false] {
let y = OneWayBoolean::new(payload);
assert_eq!(x.merge(&y).payload(), y.merge(&x).payload());
assert!(y.le(&x));
}Fields§
§flag: boolThe internal state of a OneWayBoolean is a single boolean flag
Trait Implementations§
Source§impl Clone for OneWayBoolean
impl Clone for OneWayBoolean
Source§fn clone(&self) -> OneWayBoolean
fn clone(&self) -> OneWayBoolean
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 OneWayBoolean
impl Debug for OneWayBoolean
Source§impl Grow for OneWayBoolean
impl Grow for OneWayBoolean
Source§type Payload = bool
type Payload = bool
The internal state of our
CvRDT; sufficient to build a new copy via new.
Required to implement Eq for testing and verification.Source§fn add(&mut self, _update: Self::Update)
fn add(&mut self, _update: Self::Update)
Add an item to the data structure, mutating this
CvRDT in place Read moreSource§fn le(&self, other: &OneWayBoolean) -> bool
fn le(&self, other: &OneWayBoolean) -> bool
Is this
CvRDT ≤ another in the semilattice’s partial order? Read moreSource§fn merge(&self, other: &OneWayBoolean) -> Self
fn merge(&self, other: &OneWayBoolean) -> Self
Merge this data structure and another into a new
CvRDT Read moreAuto Trait Implementations§
impl Freeze for OneWayBoolean
impl RefUnwindSafe for OneWayBoolean
impl Send for OneWayBoolean
impl Sync for OneWayBoolean
impl Unpin for OneWayBoolean
impl UnwindSafe for OneWayBoolean
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