[−][src]Struct crdts::lseq::LSeq
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
andix - 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]
T: Deserialize<'de>,
A: Deserialize<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl<T: Eq, A: Eq + Actor> Eq for LSeq<T, A>
[src]
impl<T: Hash, A: Hash + Actor> Hash for LSeq<T, A>
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
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]
fn partial_cmp(&self, other: &LSeq<T, A>) -> Option<Ordering>
[src]
fn lt(&self, other: &LSeq<T, A>) -> bool
[src]
fn le(&self, other: &LSeq<T, A>) -> bool
[src]
fn gt(&self, other: &LSeq<T, A>) -> bool
[src]
fn ge(&self, other: &LSeq<T, A>) -> bool
[src]
impl<T, A: Actor> Serialize for LSeq<T, A> where
T: Serialize,
A: Serialize,
[src]
T: Serialize,
A: Serialize,
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
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,
A: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, A> Send for LSeq<T, A> where
A: Send,
T: Send,
A: Send,
T: Send,
impl<T, A> Sync for LSeq<T, A> where
A: Sync,
T: Sync,
A: Sync,
T: Sync,
impl<T, A> Unpin for LSeq<T, A> where
A: Unpin,
T: Unpin,
A: Unpin,
T: Unpin,
impl<T, A> UnwindSafe for LSeq<T, A> where
A: UnwindSafe,
T: UnwindSafe,
A: UnwindSafe,
T: UnwindSafe,
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> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Member for T where
T: Clone + Eq + Hash,
[src]
T: Clone + Eq + Hash,
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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,