[−][src]Struct cvrdt_exposition::one_way_boolean::OneWayBoolean
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: bool
The internal state of a OneWayBoolean
is a single boolean flag
Trait Implementations
impl Clone for OneWayBoolean
[src]
fn clone(&self) -> OneWayBoolean
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for OneWayBoolean
[src]
impl Grow for OneWayBoolean
[src]
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. Read more
type Update = ()
Message to update our internal state
type Query = ()
Message to query the Value
of our CvRDT
type Value = bool
The response to a Query
fn new(payload: Self::Payload) -> Self
[src]
fn payload(&self) -> Self::Payload
[src]
fn add(&mut self, _update: Self::Update)
[src]
fn le(&self, other: &OneWayBoolean) -> bool
[src]
fn merge(&self, other: &OneWayBoolean) -> Self
[src]
fn query(&self, _query: &Self::Query) -> Self::Value
[src]
Auto Trait Implementations
impl RefUnwindSafe for OneWayBoolean
impl Send for OneWayBoolean
impl Sync for OneWayBoolean
impl Unpin for OneWayBoolean
impl UnwindSafe for OneWayBoolean
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,