[][src]Struct xi_rope::interval::Interval

pub struct Interval {
    pub start: usize,
    pub end: usize,
}

A fancy version of Range, representing a closed-open range; the interval [5, 7) is the set {5, 6}.

It is an invariant that start <= end. An interval where end < start is considered empty.

Fields

start: usizeend: usize

Methods

impl Interval[src]

pub fn new(start: usize, end: usize) -> Interval[src]

Construct a new Interval representing the range [start..end). It is an invariant that start <= end.

pub fn new_closed_open(start: usize, end: usize) -> Interval[src]

Deprecated since 0.3.0:

all intervals are now closed_open, use Interval::new

pub fn new_open_closed(start: usize, end: usize) -> Interval[src]

Deprecated since 0.3.0:

all intervals are now closed_open

pub fn new_closed_closed(start: usize, end: usize) -> Interval[src]

Deprecated since 0.3.0:

all intervals are now closed_open

pub fn new_open_open(start: usize, end: usize) -> Interval[src]

Deprecated since 0.3.0:

all intervals are now closed_open

pub fn start(&self) -> usize[src]

pub fn end(&self) -> usize[src]

pub fn start_end(&self) -> (usize, usize)[src]

pub fn is_before(&self, val: usize) -> bool[src]

the interval is before the point (the point is after the interval)

pub fn contains(&self, val: usize) -> bool[src]

the point is inside the interval

pub fn is_after(&self, val: usize) -> bool[src]

the interval is after the point (the point is before the interval)

pub fn is_empty(&self) -> bool[src]

pub fn intersect(&self, other: Interval) -> Interval[src]

pub fn union(&self, other: Interval) -> Interval[src]

pub fn prefix(&self, other: Interval) -> Interval[src]

pub fn suffix(&self, other: Interval) -> Interval[src]

pub fn translate(&self, amount: usize) -> Interval[src]

pub fn translate_neg(&self, amount: usize) -> Interval[src]

pub fn size(&self) -> usize[src]

Trait Implementations

impl PartialEq<Interval> for Interval[src]

impl Copy for Interval[src]

impl Eq for Interval[src]

impl From<Range<usize>> for Interval[src]

impl From<RangeTo<usize>> for Interval[src]

impl From<RangeInclusive<usize>> for Interval[src]

impl From<RangeToInclusive<usize>> for Interval[src]

impl Clone for Interval[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for Interval[src]

impl Display for Interval[src]

Auto Trait Implementations

Blanket Implementations

impl<T> IntervalBounds for T where
    T: Into<Interval>, 
[src]

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]