[−][src]Struct kserd::parse::Error
A hierarchy of errors which provide a trace of where the error originates.
As Kserd
s are nested, errors may occur inside other structures, creating a hierarchy of
locations where errors originate from. ParseErr
holds this hierarchy and can provide traces
and a backtrace string to better understand the error.
Methods
impl<'a> Error<'a>
[src]
pub fn get(&self, index: usize) -> Option<Trace<'a>>
[src]
Get a Trace
at the hierarchal error index.
pub fn iter<'i>(&'i self) -> impl Iterator<Item = Trace<'a>> + 'i
[src]
Iterate over the error hierarchy.
pub fn len(&self) -> usize
[src]
The number of errors in the error hierarchy.
pub fn is_empty(&self) -> bool
[src]
No errors in the rror hierarchy.
pub fn backtrace(&self) -> String
[src]
Combine the error into a backtrace.
Example
let string = " list = [ (0,1) (2,3] ] "; let fail = kserd::parse::parse(string).unwrap_err(); assert_eq!( &fail.backtrace(), r##"#0: at 4:16 :: expected ')', found ']' (2,3] ^ #1: at 4:13 :: in inline tuple (2,3] ^ #2: at 2:9 :: in newline separated (concise) kserds list = [ ^ #3: at 2:9 :: in concise sequence list = [ ^ #4: at 2:1 :: in kserdstr-kserd key-value pair list = [ ^"## );
Trait Implementations
impl<'a> Debug for Error<'a>
[src]
impl<'a> PartialEq<Error<'a>> for Error<'a>
[src]
impl<'a> StructuralPartialEq for Error<'a>
[src]
Auto Trait Implementations
impl<'a> RefUnwindSafe for Error<'a>
impl<'a> Send for Error<'a>
impl<'a> Sync for Error<'a>
impl<'a> Unpin for Error<'a>
impl<'a> UnwindSafe for Error<'a>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,