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

source

pub fn new(from: Counter, to: Counter) -> Self

source

pub fn reverse(&mut self)

source

pub fn normalize_(&mut self)

Make end greater than start

source

pub fn bidirectional(&self) -> bool

source

pub fn direction(&self) -> i32

source

pub fn is_reversed(&self) -> bool

source

pub fn min(&self) -> Counter

source

pub fn set_min(&mut self, min: Counter)

source

pub fn max(&self) -> Counter

source

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

source

pub fn contains(&self, v: Counter) -> bool

source

pub fn set_start(&mut self, new_start: Counter)

source

pub fn set_end(&mut self, new_end: Counter)

Trait Implementations§

source§

impl Clone for CounterSpan

source§

fn clone(&self) -> CounterSpan

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for CounterSpan

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl HasLength for CounterSpan

source§

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§

fn atom_len(&self) -> usize

It is the length of the atom element underneath, i.e. the length when no Mergable::merge ever happen. Read more
source§

impl Mergable for CounterSpan

source§

fn is_mergable(&self, other: &Self, _: &()) -> bool

source§

fn merge(&mut self, other: &Self, _: &())

source§

impl PartialEq for CounterSpan

source§

fn eq(&self, other: &CounterSpan) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Sliceable for CounterSpan

source§

fn slice(&self, from: usize, to: usize) -> Self

source§

impl Copy for CounterSpan

source§

impl Eq for CounterSpan

source§

impl StructuralEq for CounterSpan

source§

impl StructuralPartialEq for CounterSpan

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T, Cfg> Rle<Cfg> for Twhere T: HasLength + Sliceable + Mergable<Cfg> + Debug + Clone,