[]Struct lib_maniascript::parser::TextRange

pub struct TextRange { /* fields omitted */ }

A range in the text, represented as a pair of TextUnits.

Panics

Slicing a &str with TextRange panics if the result is not a valid utf8 string.

Methods

impl TextRange

pub fn from_to(from: TextUnit, to: TextUnit) -> TextRange

The left-inclusive range ([from..to)) between to points in the text

pub fn offset_len(offset: TextUnit, len: TextUnit) -> TextRange

The left-inclusive range ([offset..offset + len)) between to points in the text

pub fn start(&self) -> TextUnit

The inclusive start of this range

pub fn end(&self) -> TextUnit

The exclusive end of this range

pub fn len(&self) -> TextUnit

The length of this range

pub fn is_empty(&self) -> bool

Is this range empty of any content?

pub fn is_subrange(&self, other: &TextRange) -> bool

pub fn intersection(&self, other: &TextRange) -> Option<TextRange>

pub fn contains(&self, offset: TextUnit) -> bool

pub fn contains_inclusive(&self, offset: TextUnit) -> bool

pub fn checked_sub(self, other: TextUnit) -> Option<TextRange>

Trait Implementations

impl<'a> Add<&'a TextUnit> for TextRange

type Output = TextRange

The resulting type after applying the + operator.

impl<'a, 'b> Add<&'a TextUnit> for &'b TextRange

type Output = TextRange

The resulting type after applying the + operator.

impl<'a> Add<TextUnit> for &'a TextRange

type Output = TextRange

The resulting type after applying the + operator.

impl Add<TextUnit> for TextRange

type Output = TextRange

The resulting type after applying the + operator.

impl<'a> AddAssign<&'a TextUnit> for TextRange

impl AddAssign<TextUnit> for TextRange

impl Clone for TextRange

impl Copy for TextRange

impl Debug for TextRange

impl Display for TextRange

impl Eq for TextRange

impl Hash for TextRange

impl PartialEq<TextRange> for TextRange

impl RangeBounds<TextUnit> for TextRange

impl StructuralEq for TextRange

impl StructuralPartialEq for TextRange

impl<'a, 'b> Sub<&'a TextUnit> for &'b TextRange

type Output = TextRange

The resulting type after applying the - operator.

impl<'a> Sub<&'a TextUnit> for TextRange

type Output = TextRange

The resulting type after applying the - operator.

impl Sub<TextUnit> for TextRange

type Output = TextRange

The resulting type after applying the - operator.

impl<'a> Sub<TextUnit> for &'a TextRange

type Output = TextRange

The resulting type after applying the - operator.

impl<'a> SubAssign<&'a TextUnit> for TextRange

impl SubAssign<TextUnit> for TextRange

Auto Trait Implementations

Blanket Implementations

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

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

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

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

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

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

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[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.