[][src]Struct crdts::ctx::ReadCtx

pub struct ReadCtx<V, A: Actor> {
    pub add_clock: VClock<A>,
    pub rm_clock: VClock<A>,
    pub val: V,
}

ReadCtx's are used to extract data from CRDT's while maintaining some causal history. You should store ReadCtx's close to where mutation is exposed to the user.

e.g. Ship ReadCtx to the clients, then derive an Add/RmCtx and ship that back to where the CRDT is stored to perform the mutation operation.

Fields

add_clock: VClock<A>

clock used to derive an AddCtx

rm_clock: VClock<A>

clock used to derive an RmCtx

val: V

the data read from the CRDT

Implementations

impl<V, A: Actor> ReadCtx<V, A>[src]

pub fn derive_add_ctx(&self, actor: A) -> AddCtx<A>[src]

Derives an AddCtx for a given actor from a ReadCtx

pub fn derive_rm_ctx(&self) -> RmCtx<A>[src]

Derives a RmCtx from a ReadCtx

Trait Implementations

impl<V: Clone, A: Clone + Actor> Clone for ReadCtx<V, A>[src]

impl<V: Debug, A: Debug + Actor> Debug for ReadCtx<V, A>[src]

impl<'de, V, A: Actor> Deserialize<'de> for ReadCtx<V, A> where
    V: Deserialize<'de>,
    A: Deserialize<'de>, 
[src]

impl<V: Eq, A: Eq + Actor> Eq for ReadCtx<V, A>[src]

impl<V: PartialEq, A: PartialEq + Actor> PartialEq<ReadCtx<V, A>> for ReadCtx<V, A>[src]

impl<V, A: Actor> Serialize for ReadCtx<V, A> where
    V: Serialize,
    A: Serialize
[src]

impl<V, A: Actor> StructuralEq for ReadCtx<V, A>[src]

impl<V, A: Actor> StructuralPartialEq for ReadCtx<V, A>[src]

Auto Trait Implementations

impl<V, A> RefUnwindSafe for ReadCtx<V, A> where
    A: RefUnwindSafe,
    V: RefUnwindSafe

impl<V, A> Send for ReadCtx<V, A> where
    A: Send,
    V: Send

impl<V, A> Sync for ReadCtx<V, A> where
    A: Sync,
    V: Sync

impl<V, A> Unpin for ReadCtx<V, A> where
    A: Unpin,
    V: Unpin

impl<V, A> UnwindSafe for ReadCtx<V, A> where
    A: RefUnwindSafe + UnwindSafe,
    V: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,