inpt

Struct InptError

Source
pub struct InptError<'s> { /* private fields */ }
Expand description

Provides information about parsing errors.

Implementations§

Source§

impl<'s> InptError<'s>

Source

pub fn expected_regex(re: &'static str, found: &'s str) -> Self

Source

pub fn expected_regex_at_start(re: &'static str) -> Self

Source

pub fn expected_regex_at_end(re: &'static str) -> Self

Source

pub fn expected_lit(lit: &'static impl Debug, found: &'s str) -> Self

Source

pub fn expected_lit_at_start(lit: &'static impl Debug) -> Self

Source

pub fn expected_lit_at_end(lit: &'static impl Debug) -> Self

Source

pub fn expected<T>(found: &'s str) -> Self

Source

pub fn expected_at_start<T>() -> Self

Source

pub fn expected_at_end<T>() -> Self

Source

pub fn expected_regex_group(index: usize) -> Self

Source

pub fn expected_from_str<T>(found: &'s str) -> Self

Source

pub fn recursion_at_start<T>() -> Self

Source§

impl<'s> InptError<'s>

Source

pub fn row_col(&self) -> Option<Range<(usize, usize)>>

Returns the range of zero-indexed (row,column) pairs indicating the location in the input where the error occured, if any could be determined.

Source

pub fn unparsable_text(&self) -> Option<&'s str>

Returns the portion of the input text which caused the error, if any could be determined.

Source

pub fn annotated( &self, output: impl Write, force_styling: Option<bool>, ) -> Result<()>

Pretty-prints the error trace into the given writer.

Source

pub fn annotated_stdout(&self, source: &str) -> Result<()>

Pretty-prints the error trace into stdout. If the filename or other input name is known, provide it as source.

Source

pub fn annotated_stderr(&self, source: &str) -> Result<()>

Pretty-prints the error trace into stderr. If the filename or other input name is known, provide it as source.

Trait Implementations§

Source§

impl<'s> Clone for InptError<'s>

Source§

fn clone(&self) -> InptError<'s>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'s> Debug for InptError<'s>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<'a> Display for InptError<'a>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Error for InptError<'static>

1.30.0 · Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0: use the Display impl or to_string()
1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more

Auto Trait Implementations§

§

impl<'s> Freeze for InptError<'s>

§

impl<'s> !RefUnwindSafe for InptError<'s>

§

impl<'s> !Send for InptError<'s>

§

impl<'s> !Sync for InptError<'s>

§

impl<'s> Unpin for InptError<'s>

§

impl<'s> !UnwindSafe for InptError<'s>

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

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

Source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

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

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

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

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.