[][src]Struct moore::source::Location

pub struct Location {
    pub source: Source,
    pub offset: usize,
}

A single location within a source file, expressed as a byte offset.

Fields

source: Sourceoffset: usize

Implementations

impl Location[src]

pub fn new(source: Source, offset: usize) -> Location[src]

Create a new location.

pub fn iter(
    self,
    content: &'a Rc<dyn SourceContent + 'static>
) -> Box<dyn DoubleEndedIterator<Item = (usize, char)> + 'a, Global>
[src]

Obtain an iterator into the source file at this location.

pub fn human(self) -> (usize, usize, usize)[src]

Determine the line and column information at this location.

Returns a tuple (line, column, line_offset).

pub fn human_line(self) -> usize[src]

Determine the line at this location.

pub fn human_column(self) -> usize[src]

Determine the column at this location.

pub fn human_line_offset(self) -> usize[src]

Determine the line offset at this location.

Trait Implementations

impl Clone for Location[src]

impl Copy for Location[src]

impl Debug for Location[src]

impl Eq for Location[src]

impl From<Location> for Span[src]

impl Hash for Location[src]

impl Ord for Location[src]

impl PartialEq<Location> for Location[src]

impl PartialOrd<Location> for Location[src]

impl StructuralEq for Location[src]

impl StructuralPartialEq for Location[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pointable for T

type Init = T

The type for initializers.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.