[−][src]Struct jsonprima::Error
Error type of validation functions.
Fields
err: ErrorType
The ErrorType variant that describes the current error.
index_end: usize
The zero-based index before which the error ends. The character at this index will not be included.
index_start: usize
The zero-based index at which the error begins.
Methods
impl Error
[src]
pub fn new(err: ErrorType, index_start: usize, index_end: usize) -> Error
[src]
Construct a new error in the specified range.
pub fn serialize(&self) -> String
[src]
Serialize the error into a JSON value.
Examples
// Invalid `true` root value in JSON document. let text: &str = "trua"; let errors = jsonprima::validate(&text); let serialized: String = errors.get(0).unwrap().serialize(); assert_eq!(serialized, "{\"code\": \"E105\", \"description\": \"Invalid character in literal name.\", \"index_end\": 4, \"index_start\": 0}");
Trait Implementations
Auto Trait Implementations
impl Unpin for Error
impl Sync for Error
impl Send for Error
impl UnwindSafe for Error
impl RefUnwindSafe for Error
Blanket Implementations
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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
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> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,