[][src]Struct text_unit::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[src]

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

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

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

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

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

The inclusive start of this range

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

The exclusive end of this range

pub fn len(&self) -> TextUnit[src]

The length of this range

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

Is this range empty of any content?

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

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

Trait Implementations

impl Clone for TextRange[src]

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

Performs copy-assignment from source. Read more

impl Eq for TextRange[src]

impl Copy for TextRange[src]

impl PartialEq<TextRange> for TextRange[src]

impl Debug for TextRange[src]

impl Display for TextRange[src]

impl Add<TextUnit> for TextRange[src]

type Output = TextRange

The resulting type after applying the + operator.

impl<'a> Add<&'a TextUnit> for TextRange[src]

type Output = TextRange

The resulting type after applying the + operator.

impl<'a> Add<TextUnit> for &'a TextRange[src]

type Output = TextRange

The resulting type after applying the + operator.

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

type Output = TextRange

The resulting type after applying the + operator.

impl Sub<TextUnit> for TextRange[src]

type Output = TextRange

The resulting type after applying the - operator.

impl<'a> Sub<&'a TextUnit> for TextRange[src]

type Output = TextRange

The resulting type after applying the - operator.

impl<'a> Sub<TextUnit> for &'a TextRange[src]

type Output = TextRange

The resulting type after applying the - operator.

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

type Output = TextRange

The resulting type after applying the - operator.

impl AddAssign<TextUnit> for TextRange[src]

impl<'a> AddAssign<&'a TextUnit> for TextRange[src]

impl SubAssign<TextUnit> for TextRange[src]

impl<'a> SubAssign<&'a TextUnit> for TextRange[src]

impl Index<TextRange> for str[src]

type Output = str

The returned type after indexing.

impl Index<TextRange> for String[src]

type Output = str

The returned type after indexing.

impl RangeBounds<TextUnit> for TextRange[src]

fn contains<U>(&self, item: &U) -> bool where
    T: PartialOrd<U>,
    U: PartialOrd<T> + ?Sized
1.35.0[src]

Returns true if item is contained in the range. Read more

impl Hash for TextRange[src]

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0[src]

Feeds a slice of this type into the given [Hasher]. Read more

Auto Trait Implementations

impl Send for TextRange

impl Sync for TextRange

Blanket Implementations

impl<T> ToString for T where
    T: Display + ?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, 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]