Struct LineColumn

pub struct LineColumn { pub line: usize, pub column: usize }

Represents the 1-based line and column positions of a given character.

By default, the column value is measured in UTF-8 byte offsets (1-based), matching cmark behavior. This means multi-byte UTF-8 characters (for example, ö or ) increase the column count by their byte length rather than by Rust's char count.

Enable [parse.sourcepos_chars][crate::options::Parse#structfield.sourcepos_chars] to have column values reported as a Unicode character count instead.

Fields

line: usize

The 1-based line number of the character.

column: usize

The 1-based column number of the character.

By default this is counted in UTF-8 bytes (so a 3-byte character increments the column by 3). Enable [parse.sourcepos_chars][crate::options::Parse#structfield.sourcepos_chars] to have it reported as a Unicode character count instead.

Implementations

impl LineColumn

fn column_add(&self, offset: isize) -> LineColumn

Return a new LineColumn based on this one, with the column adjusted by offset.

Trait Implementations

impl Clone for LineColumn

fn clone(&self) -> LineColumn

impl Copy for LineColumn

impl Debug for LineColumn

fn fmt(&self, f: &mut Formatter<'_>) -> Result

impl Default for LineColumn

fn default() -> LineColumn

impl Eq for LineColumn

impl From<(usize, usize)> for LineColumn

fn from(lc: (usize, usize)) -> LineColumn

impl Ord for LineColumn

fn cmp(&self, other: &LineColumn) -> Ordering

impl PartialEq for LineColumn

fn eq(&self, other: &LineColumn) -> bool

impl PartialOrd for LineColumn

fn partial_cmp(&self, other: &LineColumn) -> Option<Ordering>

impl StructuralPartialEq for LineColumn

Auto Trait Implementations

impl Freeze for LineColumn

impl RefUnwindSafe for LineColumn

impl Send for LineColumn

impl Sync for LineColumn

impl Unpin for LineColumn

impl UnsafeUnpin for LineColumn

impl UnwindSafe for LineColumn

Blanket Implementations

impl<T> Any for LineColumn where T: 'static + ?Sized,

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for LineColumn where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for LineColumn where T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

impl<T> CloneToUninit for LineColumn where T: Clone,

unsafe fn clone_to_uninit(&self, dest: *mut u8)

impl<T> From<T> for LineColumn

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> ToOwned for LineColumn where T: Clone,

type Owned = T;
fn to_owned(&self) -> T
fn clone_into(&self, target: &mut T)

impl<T, U> Into<U> for LineColumn where U: From<T>,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom<U> for LineColumn where U: Into<T>,

type Error = never;
fn try_from(value: U) -> Result<T, never>

impl<T, U> TryInto<U> for LineColumn where U: TryFrom<T>,

type Error = <U as TryFrom<T>>::Error;
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>