[][src]Struct msgpack_simple::ParseError

pub struct ParseError {
    pub byte: usize,
}

An error that occurred while parsing a binary as MsgPack

Fields

byte: usize

The byte where the error was found

Implementations

impl ParseError[src]

pub fn offset(&self, value: usize) -> ParseError[src]

Creates another error of the same type with a byte offset

use msgpack_simple::ParseError;

let error = ParseError { byte: 5 };
let other = error.offset(3);

assert_eq!(other.byte, 8);

pub fn offset_result<T>(
    result: Result<T, ParseError>,
    value: usize
) -> Result<T, ParseError>
[src]

Takes a result with ParseError as its error type and returns the same with a byte offset on the error

use msgpack_simple::ParseError;

let result: Result<(), ParseError> = Err(ParseError { byte: 39 });
let other = ParseError::offset_result(result, 3);

let error = other.unwrap_err();
assert_eq!(error.byte, 42);

Trait Implementations

impl Debug for ParseError[src]

impl Display for ParseError[src]

impl Error for ParseError[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.