Struct loro_common::IdSpan
source · pub struct IdSpan {
pub client_id: PeerID,
pub counter: CounterSpan,
}Expand description
This struct supports reverse repr: CounterSpan’s from can be less than to. But we should use it conservatively. We need this because it’ll make merging deletions easier.
Fields§
§client_id: PeerID§counter: CounterSpanImplementations§
source§impl IdSpan
impl IdSpan
pub fn new(client_id: PeerID, from: Counter, to: Counter) -> Self
pub fn contains(&self, id: ID) -> bool
pub fn is_reversed(&self) -> bool
pub fn reverse(&mut self)
pub fn normalize_(&mut self)
sourcepub fn norm_id_start(&self) -> ID
pub fn norm_id_start(&self) -> ID
This is different from id_start. id_start may be greater than id_end, but this is the min of id_start and id_end-1
sourcepub fn norm_id_end(&self) -> ID
pub fn norm_id_end(&self) -> ID
This is different from id_end. id_start may be greater than id_end. This is the max of id_start+1 and id_end
pub fn to_id_span_vec(self) -> IdSpanVector
Trait Implementations§
source§impl HasLength for IdSpan
impl HasLength for IdSpan
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 PartialEq for IdSpan
impl PartialEq for IdSpan
impl Copy for IdSpan
impl Eq for IdSpan
impl StructuralEq for IdSpan
impl StructuralPartialEq for IdSpan
Auto Trait Implementations§
impl RefUnwindSafe for IdSpan
impl Send for IdSpan
impl Sync for IdSpan
impl Unpin for IdSpan
impl UnwindSafe for IdSpan
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