Struct codespan::ColumnIndex
source · [−]pub struct ColumnIndex(pub RawIndex);
Expand description
A zero-indexed column offset into a source file
Tuple Fields
0: RawIndex
Implementations
sourceimpl ColumnIndex
impl ColumnIndex
sourcepub const fn number(self) -> ColumnNumber
pub const fn number(self) -> ColumnNumber
The 1-indexed column number. Useful for pretty printing source locations.
use codespan::{ColumnIndex, ColumnNumber};
assert_eq!(format!("{}", ColumnIndex(0).number()), "1");
assert_eq!(format!("{}", ColumnIndex(3).number()), "4");
Trait Implementations
sourceimpl Add<ColumnOffset> for ColumnIndex
impl Add<ColumnOffset> for ColumnIndex
type Output = ColumnIndex
type Output = ColumnIndex
The resulting type after applying the +
operator.
sourcefn add(self, rhs: ColumnOffset) -> ColumnIndex
fn add(self, rhs: ColumnOffset) -> ColumnIndex
Performs the +
operation. Read more
sourceimpl AddAssign<ColumnOffset> for ColumnIndex
impl AddAssign<ColumnOffset> for ColumnIndex
sourcefn add_assign(&mut self, rhs: ColumnOffset)
fn add_assign(&mut self, rhs: ColumnOffset)
Performs the +=
operation. Read more
sourceimpl Clone for ColumnIndex
impl Clone for ColumnIndex
sourcefn clone(&self) -> ColumnIndex
fn clone(&self) -> ColumnIndex
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for ColumnIndex
impl Debug for ColumnIndex
sourceimpl Default for ColumnIndex
impl Default for ColumnIndex
sourcefn default() -> ColumnIndex
fn default() -> ColumnIndex
Returns the “default value” for a type. Read more
sourceimpl<'de> Deserialize<'de> for ColumnIndex
impl<'de> Deserialize<'de> for ColumnIndex
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 Display for ColumnIndex
impl Display for ColumnIndex
sourceimpl From<ColumnIndex> for RawIndex
impl From<ColumnIndex> for RawIndex
sourcefn from(index: ColumnIndex) -> RawIndex
fn from(index: ColumnIndex) -> RawIndex
Performs the conversion.
sourceimpl From<ColumnIndex> for usize
impl From<ColumnIndex> for usize
sourcefn from(index: ColumnIndex) -> usize
fn from(index: ColumnIndex) -> usize
Performs the conversion.
sourceimpl Hash for ColumnIndex
impl Hash for ColumnIndex
sourceimpl Index for ColumnIndex
impl Index for ColumnIndex
type Offset = ColumnOffset
sourceimpl Ord for ColumnIndex
impl Ord for ColumnIndex
sourceimpl PartialEq<ColumnIndex> for ColumnIndex
impl PartialEq<ColumnIndex> for ColumnIndex
sourcefn eq(&self, other: &ColumnIndex) -> bool
fn eq(&self, other: &ColumnIndex) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &ColumnIndex) -> bool
fn ne(&self, other: &ColumnIndex) -> bool
This method tests for !=
.
sourceimpl PartialOrd<ColumnIndex> for ColumnIndex
impl PartialOrd<ColumnIndex> for ColumnIndex
sourcefn partial_cmp(&self, other: &ColumnIndex) -> Option<Ordering>
fn partial_cmp(&self, other: &ColumnIndex) -> 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 Serialize for ColumnIndex
impl Serialize for ColumnIndex
sourceimpl Sub<ColumnIndex> for ColumnIndex
impl Sub<ColumnIndex> for ColumnIndex
type Output = ColumnOffset
type Output = ColumnOffset
The resulting type after applying the -
operator.
sourcefn sub(self, rhs: ColumnIndex) -> ColumnOffset
fn sub(self, rhs: ColumnIndex) -> ColumnOffset
Performs the -
operation. Read more
sourceimpl Sub<ColumnOffset> for ColumnIndex
impl Sub<ColumnOffset> for ColumnIndex
type Output = ColumnIndex
type Output = ColumnIndex
The resulting type after applying the -
operator.
sourcefn sub(self, rhs: ColumnOffset) -> ColumnIndex
fn sub(self, rhs: ColumnOffset) -> ColumnIndex
Performs the -
operation. Read more
sourceimpl SubAssign<ColumnOffset> for ColumnIndex
impl SubAssign<ColumnOffset> for ColumnIndex
sourcefn sub_assign(&mut self, rhs: ColumnOffset)
fn sub_assign(&mut self, rhs: ColumnOffset)
Performs the -=
operation. Read more
impl Copy for ColumnIndex
impl Eq for ColumnIndex
impl StructuralEq for ColumnIndex
impl StructuralPartialEq for ColumnIndex
Auto Trait Implementations
impl RefUnwindSafe for ColumnIndex
impl Send for ColumnIndex
impl Sync for ColumnIndex
impl Unpin for ColumnIndex
impl UnwindSafe for ColumnIndex
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