[−][src]Struct codespan::LineIndex
A zero-indexed line offset into a source file
Implementations
impl LineIndex
[src]
pub const fn number(self) -> LineNumber
[src]
The 1-indexed line number. Useful for pretty printing source locations.
use codespan::{LineIndex, LineNumber}; assert_eq!(format!("{}", LineIndex(0).number()), "1"); assert_eq!(format!("{}", LineIndex(3).number()), "4");
pub const fn to_usize(self) -> usize
[src]
Convert the index into a usize
, for use in array indexing
Trait Implementations
impl Add<LineOffset> for LineIndex
[src]
type Output = LineIndex
The resulting type after applying the +
operator.
fn add(self, rhs: LineOffset) -> LineIndex
[src]
impl AddAssign<LineOffset> for LineIndex
[src]
fn add_assign(&mut self, rhs: LineOffset)
[src]
impl Clone for LineIndex
[src]
impl Copy for LineIndex
[src]
impl Debug for LineIndex
[src]
impl Default for LineIndex
[src]
impl Display for LineIndex
[src]
impl Eq for LineIndex
[src]
impl From<LineIndex> for RawIndex
[src]
impl From<LineIndex> for usize
[src]
impl From<u32> for LineIndex
[src]
impl Hash for LineIndex
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl Index for LineIndex
[src]
type Offset = LineOffset
impl Ord for LineIndex
[src]
fn cmp(&self, other: &LineIndex) -> Ordering
[src]
#[must_use]fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self
[src]
impl PartialEq<LineIndex> for LineIndex
[src]
impl PartialOrd<LineIndex> for LineIndex
[src]
fn partial_cmp(&self, other: &LineIndex) -> Option<Ordering>
[src]
fn lt(&self, other: &LineIndex) -> bool
[src]
fn le(&self, other: &LineIndex) -> bool
[src]
fn gt(&self, other: &LineIndex) -> bool
[src]
fn ge(&self, other: &LineIndex) -> bool
[src]
impl StructuralEq for LineIndex
[src]
impl StructuralPartialEq for LineIndex
[src]
impl Sub<LineIndex> for LineIndex
[src]
type Output = LineOffset
The resulting type after applying the -
operator.
fn sub(self, rhs: LineIndex) -> LineOffset
[src]
impl Sub<LineOffset> for LineIndex
[src]
type Output = LineIndex
The resulting type after applying the -
operator.
fn sub(self, rhs: LineOffset) -> LineIndex
[src]
impl SubAssign<LineOffset> for LineIndex
[src]
fn sub_assign(&mut self, rhs: LineOffset)
[src]
Auto Trait Implementations
impl RefUnwindSafe for LineIndex
impl Send for LineIndex
impl Sync for LineIndex
impl Unpin for LineIndex
impl UnwindSafe for LineIndex
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub 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.
pub 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>,