[−][src]Struct rowan::TextRange
A range in the text, represented as a pair of TextUnit
s.
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 intersection(&self, other: &TextRange) -> Option<TextRange>
[src]
pub fn contains(&self, offset: TextUnit) -> bool
[src]
pub fn contains_inclusive(&self, offset: TextUnit) -> bool
[src]
pub fn checked_sub(self, other: TextUnit) -> Option<TextRange>
[src]
Trait Implementations
impl AddAssign<TextUnit> for TextRange
[src]
fn add_assign(&mut self, rhs: TextUnit)
[src]
impl<'a> AddAssign<&'a TextUnit> for TextRange
[src]
fn add_assign(&mut self, rhs: &'a TextUnit)
[src]
impl RangeBounds<TextUnit> for TextRange
[src]
fn start_bound(&self) -> Bound<&TextUnit>
[src]
fn end_bound(&self) -> Bound<&TextUnit>
[src]
fn contains<U>(&self, item: &U) -> bool where
T: PartialOrd<U>,
U: PartialOrd<T> + ?Sized,
1.35.0[src]
T: PartialOrd<U>,
U: PartialOrd<T> + ?Sized,
Returns true
if item
is contained in the range. Read more
impl Display for TextRange
[src]
impl PartialEq<TextRange> for TextRange
[src]
impl Index<TextRange> for str
[src]
impl<'a, 'b> Add<&'a TextUnit> for &'b TextRange
[src]
type Output = TextRange
The resulting type after applying the +
operator.
fn add(self, rhs: &'a TextUnit) -> TextRange
[src]
impl<'a> Add<&'a TextUnit> for TextRange
[src]
type Output = TextRange
The resulting type after applying the +
operator.
fn add(self, rhs: &'a TextUnit) -> TextRange
[src]
impl Add<TextUnit> for TextRange
[src]
type Output = TextRange
The resulting type after applying the +
operator.
fn add(self, rhs: TextUnit) -> TextRange
[src]
impl<'a> Add<TextUnit> for &'a TextRange
[src]
type Output = TextRange
The resulting type after applying the +
operator.
fn add(self, rhs: TextUnit) -> TextRange
[src]
impl SubAssign<TextUnit> for TextRange
[src]
fn sub_assign(&mut self, rhs: TextUnit)
[src]
impl<'a> SubAssign<&'a TextUnit> for TextRange
[src]
fn sub_assign(&mut self, rhs: &'a TextUnit)
[src]
impl Sub<TextUnit> for TextRange
[src]
type Output = TextRange
The resulting type after applying the -
operator.
fn sub(self, rhs: TextUnit) -> TextRange
[src]
impl<'a, 'b> Sub<&'a TextUnit> for &'b TextRange
[src]
type Output = TextRange
The resulting type after applying the -
operator.
fn sub(self, rhs: &'a TextUnit) -> TextRange
[src]
impl<'a> Sub<&'a TextUnit> for TextRange
[src]
type Output = TextRange
The resulting type after applying the -
operator.
fn sub(self, rhs: &'a TextUnit) -> TextRange
[src]
impl<'a> Sub<TextUnit> for &'a TextRange
[src]
type Output = TextRange
The resulting type after applying the -
operator.
fn sub(self, rhs: TextUnit) -> TextRange
[src]
impl Eq for TextRange
[src]
impl Hash for TextRange
[src]
fn hash<__H>(&self, state: &mut __H) where
__H: Hasher,
[src]
__H: Hasher,
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl Debug for TextRange
[src]
impl Copy for TextRange
[src]
impl Clone for TextRange
[src]
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,