[]Struct rnix::TextUnit

pub struct TextUnit(_);

An offset into text. Offset is represented as u32 storing number of utf8-bytes, but most of the clients should treat it like opaque measure.

Methods

impl TextUnit

pub fn of_char(c: char) -> TextUnit

TextUnit equal to the length of this char.

pub fn of_str(s: &str) -> TextUnit

TextUnit equal to the length of this string.

Panics

Panics if the length of the string is greater than u32::max_value()

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

pub fn from_usize(size: usize) -> TextUnit

pub fn to_usize(self) -> usize

Trait Implementations

impl Debug for TextUnit

impl SubAssign<TextUnit> for TextUnit

impl SubAssign<TextUnit> for TextRange

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

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

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

type Output = TextRange

The resulting type after applying the - operator.

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

type Output = TextUnit

The resulting type after applying the - operator.

impl Sub<TextUnit> for TextUnit

type Output = TextUnit

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<&'a TextUnit> for TextUnit

type Output = TextUnit

The resulting type after applying the - operator.

impl<'a, 'b> Sub<&'a TextUnit> for &'b 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, 'b> Sub<&'a TextUnit> for &'b TextUnit

type Output = TextUnit

The resulting type after applying the - operator.

impl Eq for TextUnit

impl PartialOrd<TextUnit> for TextUnit

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

impl AddAssign<TextUnit> for TextRange

impl AddAssign<TextUnit> for TextUnit

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

impl Ord for TextUnit

impl Hash for TextUnit

impl RangeBounds<TextUnit> for TextRange

impl Clone for TextUnit

impl Display for TextUnit

impl Default for TextUnit

impl Copy for TextUnit

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 TextUnit

type Output = TextUnit

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<'a> Add<&'a TextUnit> for TextRange

type Output = TextRange

The resulting type after applying the + operator.

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

type Output = TextUnit

The resulting type after applying the + operator.

impl Add<TextUnit> for TextUnit

type Output = TextUnit

The resulting type after applying the + operator.

impl Add<TextUnit> for TextRange

type Output = TextRange

The resulting type after applying the + operator.

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

type Output = TextUnit

The resulting type after applying the + operator.

impl Sum<TextUnit> for TextUnit

impl<'a> Sum<&'a TextUnit> for TextUnit

impl From<u32> for TextUnit

impl PartialEq<TextUnit> for TextUnit

Auto Trait Implementations

Blanket Implementations

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, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for 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]