pub struct LineIndex(pub u32);
Expand description
A zero-indexed line number
Tuple Fields§
§0: u32
Implementations§
Source§impl LineIndex
impl LineIndex
Sourcepub const fn number(self) -> LineNumber
pub const fn number(self) -> LineNumber
Convert to a LineNumber
Sourcepub fn checked_add(self, offset: u32) -> Option<Self>
pub fn checked_add(self, offset: u32) -> Option<Self>
Add offset
to this index, returning None
on overflow
Sourcepub fn checked_add_signed(self, offset: i32) -> Option<Self>
pub fn checked_add_signed(self, offset: i32) -> Option<Self>
Add a signed offset
to this index, returning None
on overflow
Sourcepub fn checked_sub(self, offset: u32) -> Option<Self>
pub fn checked_sub(self, offset: u32) -> Option<Self>
Subtract offset
from this index, returning None
on underflow
Sourcepub const fn saturating_add(self, offset: u32) -> Self
pub const fn saturating_add(self, offset: u32) -> Self
Add offset
to this index, saturating to u32::MAX
on overflow
Sourcepub const fn saturating_add_signed(self, offset: i32) -> Self
pub const fn saturating_add_signed(self, offset: i32) -> Self
Add a signed offset
to this index, saturating to 0
on underflow, and u32::MAX
on overflow.
Sourcepub const fn saturating_sub(self, offset: u32) -> Self
pub const fn saturating_sub(self, offset: u32) -> Self
Subtract offset
from this index, saturating to 0
on overflow
Trait Implementations§
Source§impl AddAssign<i32> for LineIndex
impl AddAssign<i32> for LineIndex
Source§fn add_assign(&mut self, rhs: i32)
fn add_assign(&mut self, rhs: i32)
Performs the
+=
operation. Read moreSource§impl AddAssign<u32> for LineIndex
impl AddAssign<u32> for LineIndex
Source§fn add_assign(&mut self, rhs: u32)
fn add_assign(&mut self, rhs: u32)
Performs the
+=
operation. Read moreSource§impl<'de> Deserialize<'de> for LineIndex
impl<'de> Deserialize<'de> for LineIndex
Source§fn 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
Source§impl From<LineIndex> for LineNumber
impl From<LineIndex> for LineNumber
Source§impl From<LineNumber> for LineIndex
impl From<LineNumber> for LineIndex
Source§fn from(index: LineNumber) -> Self
fn from(index: LineNumber) -> Self
Converts to this type from the input type.
Source§impl Ord for LineIndex
impl Ord for LineIndex
Source§impl PartialOrd for LineIndex
impl PartialOrd for LineIndex
Source§impl SubAssign<u32> for LineIndex
impl SubAssign<u32> for LineIndex
Source§fn sub_assign(&mut self, rhs: u32)
fn sub_assign(&mut self, rhs: u32)
Performs the
-=
operation. Read moreimpl Copy for LineIndex
impl Eq for LineIndex
impl StructuralPartialEq for LineIndex
Auto Trait Implementations§
impl Freeze for LineIndex
impl RefUnwindSafe for LineIndex
impl Send for LineIndex
impl Sync for LineIndex
impl Unpin for LineIndex
impl UnwindSafe for LineIndex
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more