Struct lang_util::position::LexerPosition
source · pub struct LexerPosition {
pub source_id: FileId,
pub offset: TextSize,
}
Expand description
A position in the lexer’s input
Fields§
§source_id: FileId
Source id
offset: TextSize
Raw byte offset
Implementations§
source§impl LexerPosition
impl LexerPosition
sourcepub fn new_raw<E: Debug>(
source_id: FileId,
offset: impl TryInto<u32, Error = E>
) -> Self
pub fn new_raw<E: Debug>( source_id: FileId, offset: impl TryInto<u32, Error = E> ) -> Self
Create a new LexerPosition
Parameters
source_id
: source idoffset
: raw byte offset in the input
Panics
Panics if the offset can’t be converted to a u32.
Trait Implementations§
source§impl Clone for LexerPosition
impl Clone for LexerPosition
source§fn clone(&self) -> LexerPosition
fn clone(&self) -> LexerPosition
Returns a copy 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 LexerPosition
impl Debug for LexerPosition
source§impl Default for LexerPosition
impl Default for LexerPosition
source§fn default() -> LexerPosition
fn default() -> LexerPosition
Returns the “default value” for a type. Read more
source§impl Display for LexerPosition
impl Display for LexerPosition
source§impl From<LexerPosition> for FileId
impl From<LexerPosition> for FileId
source§fn from(value: LexerPosition) -> Self
fn from(value: LexerPosition) -> Self
Converts to this type from the input type.
source§impl From<LexerPosition> for TextSize
impl From<LexerPosition> for TextSize
source§fn from(value: LexerPosition) -> Self
fn from(value: LexerPosition) -> Self
Converts to this type from the input type.
source§impl Hash for LexerPosition
impl Hash for LexerPosition
source§impl Ord for LexerPosition
impl Ord for LexerPosition
source§fn cmp(&self, other: &LexerPosition) -> Ordering
fn cmp(&self, other: &LexerPosition) -> 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 LexerPosition
impl PartialEq for LexerPosition
source§fn eq(&self, other: &LexerPosition) -> bool
fn eq(&self, other: &LexerPosition) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd for LexerPosition
impl PartialOrd for LexerPosition
source§fn partial_cmp(&self, other: &LexerPosition) -> Option<Ordering>
fn partial_cmp(&self, other: &LexerPosition) -> Option<Ordering>
1.0.0 · source§fn 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 moreimpl Copy for LexerPosition
impl Eq for LexerPosition
impl StructuralEq for LexerPosition
impl StructuralPartialEq for LexerPosition
Auto Trait Implementations§
impl RefUnwindSafe for LexerPosition
impl Send for LexerPosition
impl Sync for LexerPosition
impl Unpin for LexerPosition
impl UnwindSafe for LexerPosition
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