pub struct LineNumberCache { /* fields omitted */ }
Return a LineNumberCache
with UNIX-style line breaks (single \n
byte) at byte offsets given in linebreaks
.
Return the line number at byte_offset
.
Identical to row() + 1
.
This does not detect errors caused by byte_offset
s that
are out of range. Prefer the safe API of the Position
struct
instead.
Return the column of the characters position within the file.
The column is zero based, meaning the first characters of
a line/row is positioned at column 0
.
This does not detect errors caused by byte_offset
s that
are out of range. Prefer the safe API of the Position
struct
instead.
Return the row of the character's position within the file.
This does not detect errors caused by byte_offset
s that
are out of range. Prefer the safe API of the Position
struct
instead.
Get row and column at once. Equivalent to calling
row(&self, byte_offset: usize)
and column(&self, byte_offset: usize)
.
This method exists because most of the time you want both.
And it's more efficient to look up both at once.
This does not detect errors caused by byte_offset
s that
are out of range. Prefer the safe API of the Position
struct
instead.
Formats the value using the given formatter. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static