pub struct InptError<'s> { /* private fields */ }
Expand description
Provides information about parsing errors.
Implementations§
Source§impl<'s> InptError<'s>
impl<'s> InptError<'s>
pub fn expected_regex(re: &'static str, found: &'s str) -> Self
pub fn expected_regex_at_start(re: &'static str) -> Self
pub fn expected_regex_at_end(re: &'static str) -> Self
pub fn expected_lit(lit: &'static impl Debug, found: &'s str) -> Self
pub fn expected_lit_at_start(lit: &'static impl Debug) -> Self
pub fn expected_lit_at_end(lit: &'static impl Debug) -> Self
pub fn expected<T>(found: &'s str) -> Self
pub fn expected_at_start<T>() -> Self
pub fn expected_at_end<T>() -> Self
pub fn expected_regex_group(index: usize) -> Self
pub fn expected_from_str<T>(found: &'s str) -> Self
pub fn recursion_at_start<T>() -> Self
Source§impl<'s> InptError<'s>
impl<'s> InptError<'s>
Sourcepub fn row_col(&self) -> Option<Range<(usize, usize)>>
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.
Sourcepub fn unparsable_text(&self) -> Option<&'s str>
pub fn unparsable_text(&self) -> Option<&'s str>
Returns the portion of the input text which caused the error, if any could be determined.
Sourcepub fn annotated(
&self,
output: impl Write,
force_styling: Option<bool>,
) -> Result<()>
pub fn annotated( &self, output: impl Write, force_styling: Option<bool>, ) -> Result<()>
Pretty-prints the error trace into the given writer.
Sourcepub fn annotated_stdout(&self, source: &str) -> Result<()>
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
.
Sourcepub fn annotated_stderr(&self, source: &str) -> Result<()>
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 Error for InptError<'static>
impl Error for InptError<'static>
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
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
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
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> 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)