[][src]Struct nom_supreme::final_parser::Location

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

A location in a string where an error may have occurred. In keeping with the typical practice from editors and other tools, line and columns are both 1-indexed.

Example

use nom_supreme::final_parser::{RecreateContext, Location};

let original_input = "Hello,\nWorld!\n";
let tail = &original_input[9..];

assert_eq!(
   Location::recreate_context(original_input, tail),
   Location { line: 2, column: 3 },
);

Fields

line: usize

The line number in the original input where the error occurred

column: usize

The column of the line in the original input where the error occurred

Implementations

impl Location[src]

pub fn locate_tail<'a>(original_input: &'a str, tail: &'a str) -> Self[src]

Given the original input string, as well as the context reported by nom, compute the location in the original string where the error occurred.

This function will report garbage (and may panic) if the context is not associated with the input

Trait Implementations

impl Clone for Location[src]

impl Copy for Location[src]

impl Debug for Location[src]

impl Display for Location[src]

impl Eq for Location[src]

impl PartialEq<Location> for Location[src]

impl<'_> RecreateContext<&'_ str> 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> Conv for T

impl<T> Conv for T

impl<I, T> ExtractContext<I, ()> for T[src]

impl<T> FmtForward for T

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

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

impl<T> Pipe for T where
    T: ?Sized

impl<T> Pipe for T

impl<T> PipeAsRef for T

impl<T> PipeBorrow for T

impl<T> PipeDeref for T

impl<T> PipeRef for T

impl<I> RecreateContext<I> for I[src]

impl<T> Tap for T

impl<T> Tap for T

impl<T, U> TapAsRef<U> for T where
    U: ?Sized

impl<T, U> TapBorrow<U> for T where
    U: ?Sized

impl<T> TapDeref for T

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

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T> TryConv for T

impl<T> TryConv for T

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.