Struct loro_common::CounterSpan
source · pub struct CounterSpan {
pub start: Counter,
pub end: Counter,
}Expand description
This struct supports reverse repr: from can be less than to.
We need this because it’ll make merging deletions easier.
But we should use it behavior conservatively. If it is not necessary to be reverse, it should not.
Fields§
§start: Counter§end: CounterImplementations§
source§impl CounterSpan
impl CounterSpan
pub fn new(from: Counter, to: Counter) -> Self
pub fn reverse(&mut self)
sourcepub fn normalize_(&mut self)
pub fn normalize_(&mut self)
Make end greater than start
pub fn bidirectional(&self) -> bool
pub fn direction(&self) -> i32
pub fn is_reversed(&self) -> bool
pub fn min(&self) -> Counter
pub fn set_min(&mut self, min: Counter)
pub fn max(&self) -> Counter
sourcepub fn norm_end(&self) -> i32
pub fn norm_end(&self) -> i32
This is different from end. start may be greater than end. This is the max of start+1 and end
pub fn contains(&self, v: Counter) -> bool
pub fn set_start(&mut self, new_start: Counter)
pub fn set_end(&mut self, new_end: Counter)
Trait Implementations§
source§impl Clone for CounterSpan
impl Clone for CounterSpan
source§fn clone(&self) -> CounterSpan
fn clone(&self) -> CounterSpan
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresource§impl Debug for CounterSpan
impl Debug for CounterSpan
source§impl HasLength for CounterSpan
impl HasLength for CounterSpan
source§fn content_len(&self) -> usize
fn content_len(&self) -> usize
It is the length of the content, i.e. the length when no Mergable::merge ever happen. Read more
source§impl Mergable for CounterSpan
impl Mergable for CounterSpan
source§impl PartialEq for CounterSpan
impl PartialEq for CounterSpan
source§fn eq(&self, other: &CounterSpan) -> bool
fn eq(&self, other: &CounterSpan) -> bool
This method tests for
self and other values to be equal, and is used
by ==.impl Copy for CounterSpan
impl Eq for CounterSpan
impl StructuralEq for CounterSpan
impl StructuralPartialEq for CounterSpan
Auto Trait Implementations§
impl RefUnwindSafe for CounterSpan
impl Send for CounterSpan
impl Sync for CounterSpan
impl Unpin for CounterSpan
impl UnwindSafe for CounterSpan
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more