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: Counter
Implementations§
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
Normalized end value.
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)
pub fn extend_include(&mut self, new_start: Counter, 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 duplicate 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
impl Copy for CounterSpan
impl Eq for CounterSpan
impl StructuralPartialEq for CounterSpan
Auto Trait Implementations§
impl Freeze for CounterSpan
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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