pub struct IdSpan {
pub peer: 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§
§peer: PeerID
§counter: CounterSpan
Implementations§
Source§impl IdSpan
impl IdSpan
pub fn new(peer: 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
pub fn get_intersection(&self, other: &Self) -> Option<Self>
pub fn get_slice_range_on(&self, other: &Self) -> Option<(usize, usize)>
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
impl Copy for IdSpan
impl Eq for IdSpan
impl StructuralPartialEq for IdSpan
Auto Trait Implementations§
impl Freeze for IdSpan
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> HasCounterSpan for Twhere
T: HasCounter + HasLength,
impl<T> HasCounterSpan for Twhere
T: HasCounter + HasLength,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more