pub enum ParseError {
NoLeadingSlash,
InvalidEncoding {
offset: usize,
source: EncodingError,
},
}
Expand description
Indicates that a Pointer
was malformed and unable to be parsed.
Variants§
NoLeadingSlash
Pointer
did not start with a slash ('/'
).
InvalidEncoding
Pointer
contained invalid encoding (e.g. ~
not followed by 0
or
1
).
Fields
§
offset: usize
Offset of the partial pointer starting with the token that contained the invalid encoding
§
source: EncodingError
The source InvalidEncodingError
Implementations§
Source§impl ParseError
impl ParseError
Source§impl ParseError
impl ParseError
Sourcepub fn is_no_leading_backslash(&self) -> bool
👎Deprecated since 0.7.0: renamed to is_no_leading_slash
pub fn is_no_leading_backslash(&self) -> bool
is_no_leading_slash
Returns true
if this error is NoLeadingSlash
Sourcepub fn is_no_leading_slash(&self) -> bool
pub fn is_no_leading_slash(&self) -> bool
Returns true
if this error is NoLeadingSlash
Sourcepub fn is_invalid_encoding(&self) -> bool
pub fn is_invalid_encoding(&self) -> bool
Returns true
if this error is InvalidEncoding
Sourcepub fn pointer_offset(&self) -> usize
pub fn pointer_offset(&self) -> usize
Offset of the partial pointer starting with the token which caused the error.
"/foo/invalid~tilde/invalid"
↑
let err = PointerBuf::parse("/foo/invalid~tilde/invalid").unwrap_err();
assert_eq!(err.pointer_offset(), 4)
Sourcepub fn source_offset(&self) -> usize
pub fn source_offset(&self) -> usize
Offset of the character index from within the first token of
Self::pointer_offset
)
"/foo/invalid~tilde/invalid"
↑
8
let err = PointerBuf::parse("/foo/invalid~tilde/invalid").unwrap_err();
assert_eq!(err.source_offset(), 8)
Sourcepub fn complete_offset(&self) -> usize
pub fn complete_offset(&self) -> usize
Offset of the first invalid encoding from within the pointer.
"/foo/invalid~tilde/invalid"
↑
12
use jsonptr::PointerBuf;
let err = PointerBuf::parse("/foo/invalid~tilde/invalid").unwrap_err();
assert_eq!(err.complete_offset(), 12)
Trait Implementations§
Source§impl Debug for ParseError
impl Debug for ParseError
Source§impl Diagnostic for ParseError
impl Diagnostic for ParseError
Source§impl Display for ParseError
impl Display for ParseError
Source§impl Error for ParseError
impl Error for ParseError
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 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