pub struct LineIndex(pub RawIndex);
Expand description
A zero-indexed line offset into a source file
Tuple Fields
0: RawIndex
Implementations
sourceimpl LineIndex
impl LineIndex
sourcepub const fn number(self) -> LineNumber
pub const fn number(self) -> LineNumber
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");
Trait Implementations
sourceimpl Add<LineOffset> for LineIndex
impl Add<LineOffset> for LineIndex
sourceimpl AddAssign<LineOffset> for LineIndex
impl AddAssign<LineOffset> for LineIndex
sourcefn add_assign(&mut self, rhs: LineOffset)
fn add_assign(&mut self, rhs: LineOffset)
Performs the +=
operation. Read more
sourceimpl<'de> Deserialize<'de> for LineIndex
impl<'de> Deserialize<'de> for LineIndex
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl Index for LineIndex
impl Index for LineIndex
type Offset = LineOffset
sourceimpl Ord for LineIndex
impl Ord for LineIndex
sourceimpl PartialOrd<LineIndex> for LineIndex
impl PartialOrd<LineIndex> for LineIndex
sourcefn partial_cmp(&self, other: &LineIndex) -> Option<Ordering>
fn partial_cmp(&self, other: &LineIndex) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl Sub<LineIndex> for LineIndex
impl Sub<LineIndex> for LineIndex
type Output = LineOffset
type Output = LineOffset
The resulting type after applying the -
operator.
sourcefn sub(self, rhs: LineIndex) -> LineOffset
fn sub(self, rhs: LineIndex) -> LineOffset
Performs the -
operation. Read more
sourceimpl Sub<LineOffset> for LineIndex
impl Sub<LineOffset> for LineIndex
sourceimpl SubAssign<LineOffset> for LineIndex
impl SubAssign<LineOffset> for LineIndex
sourcefn sub_assign(&mut self, rhs: LineOffset)
fn sub_assign(&mut self, rhs: LineOffset)
Performs the -=
operation. Read more
impl Copy for LineIndex
impl Eq for LineIndex
impl StructuralEq for LineIndex
impl StructuralPartialEq for LineIndex
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more