[][src]Struct unsegen::base::basic_types::LineIndex

pub struct LineIndex(_);

A type for enumerating lines by index (rather than by number), i.e., starting from 0. Conversions between LineNumber and LineIndex are always safe.

Implementations

impl LineIndex[src]

pub fn new(val: usize) -> Self[src]

Create a new LineIndex from a raw value.

pub fn raw_value(self) -> usize[src]

Unpack the LineIndex and yield the underlying value.

pub fn checked_sub(&self, rhs: usize) -> Option<LineIndex>[src]

Checked integer subtraction. Computes self - rhs, returning None if the result is invalid (i.e., smaller than 0).

Examples:

use unsegen::base::LineIndex;
assert_eq!(LineIndex::new(37).checked_sub(27), Some(LineIndex::new(10)));
assert_eq!(LineIndex::new(27).checked_sub(37), None);

Trait Implementations

impl Add<usize> for LineIndex[src]

type Output = Self

The resulting type after applying the + operator.

impl AddAssign<usize> for LineIndex[src]

impl Clone for LineIndex[src]

impl Copy for LineIndex[src]

impl Debug for LineIndex[src]

impl Display for LineIndex[src]

impl Eq for LineIndex[src]

impl From<LineIndex> for LineNumber[src]

impl From<LineNumber> for LineIndex[src]

impl Hash for LineIndex[src]

impl Into<usize> for LineIndex[src]

impl PartialEq<LineIndex> for LineIndex[src]

impl PartialOrd<LineIndex> for LineIndex[src]

impl StructuralEq for LineIndex[src]

impl StructuralPartialEq for LineIndex[src]

impl Sub<usize> for LineIndex[src]

type Output = Self

The resulting type after applying the - operator.

impl SubAssign<usize> for LineIndex[src]

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.