pub struct GList<T: Ord> { /* private fields */ }
Expand description
The GList is a grow-only list, that is, it allows inserts but not deletes. Elements in the list are paths through an ordered tree, the tree grows deeper when we try to insert between two elements who were inserted concurrently and whose paths happen to have the same prefix.
Implementations§
source§impl<T: Ord + Clone> GList<T>
impl<T: Ord + Clone> GList<T>
sourcepub fn read<'a, C: FromIterator<&'a T>>(&'a self) -> C
pub fn read<'a, C: FromIterator<&'a T>>(&'a self) -> C
Read the elements of the list into a user defined container
sourcepub fn read_into<C: FromIterator<T>>(self) -> C
pub fn read_into<C: FromIterator<T>>(self) -> C
Read the elements of the list into a user defined container, consuming the list in the process.
sourcepub fn iter(&self) -> Iter<'_, Identifier<T>>
pub fn iter(&self) -> Iter<'_, Identifier<T>>
Iterate over the elements of the list
sourcepub fn get(&self, idx: usize) -> Option<&Identifier<T>>
pub fn get(&self, idx: usize) -> Option<&Identifier<T>>
Return the element and it’s marker at the specified index
sourcepub fn insert_before(
&self,
high_id_opt: Option<&Identifier<T>>,
elem: T
) -> Op<T>
pub fn insert_before( &self, high_id_opt: Option<&Identifier<T>>, elem: T ) -> Op<T>
Generate an Op to insert the given element before the given marker
sourcepub fn insert_after(&self, low_id_opt: Option<&Identifier<T>>, elem: T) -> Op<T>
pub fn insert_after(&self, low_id_opt: Option<&Identifier<T>>, elem: T) -> Op<T>
Generate an insert op to insert the given element after the given marker
sourcepub fn first(&self) -> Option<&Identifier<T>>
pub fn first(&self) -> Option<&Identifier<T>>
Get first element of the sequence represented by the list.
sourcepub fn last(&self) -> Option<&Identifier<T>>
pub fn last(&self) -> Option<&Identifier<T>>
Get last element of the sequence represented by the list.
Trait Implementations§
source§impl<T: Ord> CmRDT for GList<T>
impl<T: Ord> CmRDT for GList<T>
§type Op = Op<T>
type Op = Op<T>
§type Validation = Infallible
type Validation = Infallible
validate_op
.source§fn validate_op(&self, _: &Self::Op) -> Result<(), Self::Validation>
fn validate_op(&self, _: &Self::Op) -> Result<(), Self::Validation>
source§impl<T: Ord> CvRDT for GList<T>
impl<T: Ord> CvRDT for GList<T>
§type Validation = Infallible
type Validation = Infallible
validate_merge
.