pub struct ParseError {
pub start_loc: usize,
pub end_loc: Option<usize>,
pub err: ParseErrorKind,
}
Expand description
An error parsing the provided string into a Value
Fields§
§start_loc: usize
Byte offset into the provided string that the error begins.
end_loc: Option<usize>
Byte offset into the provided string that the error ends. Many errors begin at some point but do not have a known end position.
err: ParseErrorKind
Details about the error that occurred.
Implementations§
Source§impl ParseError
impl ParseError
Sourcepub fn new_at<E: Into<ParseErrorKind>>(err: E, loc: usize) -> Self
pub fn new_at<E: Into<ParseErrorKind>>(err: E, loc: usize) -> Self
Construct a new ParseError
for tokens at the given location.
Sourcepub fn new_between<E: Into<ParseErrorKind>>(
err: E,
start: usize,
end: usize,
) -> Self
pub fn new_between<E: Into<ParseErrorKind>>( err: E, start: usize, end: usize, ) -> Self
Construct a new ParseError
for tokens between the given locations.
Trait Implementations§
Source§impl Debug for ParseError
impl Debug for ParseError
Source§impl Display for ParseError
impl Display for ParseError
Source§impl Error for ParseError
impl Error for ParseError
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()
Source§impl PartialEq for ParseError
impl PartialEq for ParseError
impl Eq for ParseError
impl StructuralPartialEq for ParseError
Auto Trait Implementations§
impl Freeze for ParseError
impl RefUnwindSafe for ParseError
impl Send for ParseError
impl Sync for ParseError
impl Unpin for ParseError
impl UnwindSafe for ParseError
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more