pub struct LineNumber(/* private fields */);
Expand description
A one-indexed line number
Implementations§
Source§impl LineNumber
impl LineNumber
pub const fn new(number: u32) -> Option<Self>
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 fn saturating_add_signed(self, offset: i32) -> Self
pub 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 fn saturating_sub(self, offset: u32) -> Self
pub fn saturating_sub(self, offset: u32) -> Self
Subtract offset
from this index, saturating to 0
on overflow
Trait Implementations§
Source§impl Add<i32> for LineNumber
impl Add<i32> for LineNumber
Source§impl Add<u32> for LineNumber
impl Add<u32> for LineNumber
Source§impl AddAssign<i32> for LineNumber
impl AddAssign<i32> for LineNumber
Source§fn add_assign(&mut self, rhs: i32)
fn add_assign(&mut self, rhs: i32)
Performs the
+=
operation. Read moreSource§impl AddAssign<u32> for LineNumber
impl AddAssign<u32> for LineNumber
Source§fn add_assign(&mut self, rhs: u32)
fn add_assign(&mut self, rhs: u32)
Performs the
+=
operation. Read moreSource§impl Clone for LineNumber
impl Clone for LineNumber
Source§fn clone(&self) -> LineNumber
fn clone(&self) -> LineNumber
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for LineNumber
impl Debug for LineNumber
Source§impl Default for LineNumber
impl Default for LineNumber
Source§impl<'de> Deserialize<'de> for LineNumber
impl<'de> Deserialize<'de> for LineNumber
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 Display for LineNumber
impl Display for LineNumber
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 From<NonZero<u32>> for LineNumber
impl From<NonZero<u32>> for LineNumber
Source§fn from(index: NonZeroU32) -> Self
fn from(index: NonZeroU32) -> Self
Converts to this type from the input type.
Source§impl Hash for LineNumber
impl Hash for LineNumber
Source§impl Ord for LineNumber
impl Ord for LineNumber
Source§fn cmp(&self, other: &LineNumber) -> Ordering
fn cmp(&self, other: &LineNumber) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for LineNumber
impl PartialEq for LineNumber
Source§impl PartialOrd for LineNumber
impl PartialOrd for LineNumber
Source§impl Serialize for LineNumber
impl Serialize for LineNumber
Source§impl Sub<u32> for LineNumber
impl Sub<u32> for LineNumber
Source§impl SubAssign<u32> for LineNumber
impl SubAssign<u32> for LineNumber
Source§fn sub_assign(&mut self, rhs: u32)
fn sub_assign(&mut self, rhs: u32)
Performs the
-=
operation. Read moreimpl Copy for LineNumber
impl Eq for LineNumber
impl StructuralPartialEq for LineNumber
Auto Trait Implementations§
impl Freeze for LineNumber
impl RefUnwindSafe for LineNumber
impl Send for LineNumber
impl Sync for LineNumber
impl Unpin for LineNumber
impl UnwindSafe for LineNumber
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