[][src]Struct crdts::lseq::LSeq

pub struct LSeq<T, A: Actor> { /* fields omitted */ }

As described in the module documentation:

An LSEQ tree is a CRDT for storing sequences of data (Strings, ordered lists). It provides an efficient view of the stored sequence, with fast index, insertion and deletion operations.

Implementations

impl<T: Clone, A: Actor> LSeq<T, A>[src]

pub fn new(id: A) -> Self[src]

Create an empty LSEQ

pub fn new_with_args(id: A, base: u8, boundary: u64) -> Self[src]

Create an empty LSEQ with custom base size

pub fn insert_index(&mut self, ix: usize, val: T) -> Op<T, A>[src]

Perform a local insertion of an element at a given position. If ix is greater than the length of the LSeq then it is appended to the end.

Panics

  • If the allocation of a new index was not between ix and ix - 1.

pub fn append(&mut self, c: T) -> Op<T, A>[src]

Perform a local insertion of an element at the end of the sequence.

pub fn delete_index(&mut self, ix: usize) -> Option<Op<T, A>>[src]

Perform a local deletion at ix.

If ix is out of bounds, i.e. ix > self.len(), then the Op is not performed and None is returned.

pub fn delete_index_or_last(&mut self, ix: usize) -> Op<T, A>[src]

Perform a local deletion at ix. If ix is out of bounds then the last element will be deleted, i.e. self.len() - 1.

pub fn len(&self) -> usize[src]

Get the length of the LSEQ.

pub fn is_empty(&self) -> bool[src]

Check if the LSEQ is empty.

pub fn iter(&self) -> impl Iterator<Item = &T> + '_[src]

Get the elements represented by the LSEQ.

pub fn iter_entries(&self) -> impl Iterator<Item = &Entry<T, A>> + '_[src]

Get the elements' Entry from the LSEQ.

pub fn get(&self, ix: usize) -> Option<&T>[src]

Get an element at an index from the sequence represented by the LSEQ.

pub fn find_entry(&self, ident: &Identifier<A>) -> Option<&Entry<T, A>>[src]

Finds an entry searching by its Identifier.

pub fn last(&self) -> Option<&T>[src]

Get last element of the sequence represented by the LSEQ.

pub fn last_entry(&self) -> Option<&Entry<T, A>>[src]

Get the last Entry of the sequence represented by the LSEQ.

pub fn actor(&self) -> A[src]

Actor who is initiating operations on this LSeq

Trait Implementations

impl<T: Clone, A: Clone + Actor> Clone for LSeq<T, A>[src]

impl<T: Clone, A: Actor> CmRDT for LSeq<T, A>[src]

type Op = Op<T, A>

Op defines a mutation to the CRDT. As long as Op's from one actor are replayed in exactly the same order they were generated by that actor, the CRDT will converge. In other words, we must have a total ordering on each actors operations, while requiring only a partial order over all ops. E.g. Read more

fn apply(&mut self, op: Self::Op)[src]

Apply an operation to an LSeq instance.

If the operation is an insert and the identifier is already present in the LSEQ instance the result is a no-op

If the operation is a delete and the identifier is not present in the LSEQ instance the result is a no-op

impl<'de, T, A: Actor> Deserialize<'de> for LSeq<T, A> where
    T: Deserialize<'de>,
    A: Deserialize<'de>, 
[src]

impl<T: Eq, A: Eq + Actor> Eq for LSeq<T, A>[src]

impl<T: Hash, A: Hash + Actor> Hash for LSeq<T, A>[src]

impl<T: PartialEq, A: PartialEq + Actor> PartialEq<LSeq<T, A>> for LSeq<T, A>[src]

impl<T: PartialOrd, A: PartialOrd + Actor> PartialOrd<LSeq<T, A>> for LSeq<T, A>[src]

impl<T, A: Actor> Serialize for LSeq<T, A> where
    T: Serialize,
    A: Serialize
[src]

impl<T, A: Actor> StructuralEq for LSeq<T, A>[src]

impl<T, A: Actor> StructuralPartialEq for LSeq<T, A>[src]

Auto Trait Implementations

impl<T, A> RefUnwindSafe for LSeq<T, A> where
    A: RefUnwindSafe,
    T: RefUnwindSafe

impl<T, A> Send for LSeq<T, A> where
    A: Send,
    T: Send

impl<T, A> Sync for LSeq<T, A> where
    A: Sync,
    T: Sync

impl<T, A> Unpin for LSeq<T, A> where
    A: Unpin,
    T: Unpin

impl<T, A> UnwindSafe for LSeq<T, A> where
    A: UnwindSafe,
    T: 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> Member for T where
    T: Clone + Eq + Hash
[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>,