1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
use thiserror::Error;
use std::str::Utf8Error;
#[allow(unused_imports)]
use crate::parser::BytesParser;
#[derive(Error, Debug, Eq, PartialEq)]
pub enum BytesParserError {
#[error("Not enough bytes left to parse for {0}")]
NotEnoughBytesForTypeError(String),
#[error("Not enough bytes left to parse a string of {0} bytes")]
NotEnoughBytesForStringError(usize),
#[error("Not enough bytes left to cut a slice of size {0}")]
NotEnoughBytesForSlice(usize),
#[error("Moving cursor to/by {0} would place it out-of-bound: bytes array length is {1} and cursor is at {2}")]
CursorOutOfBoundError(isize, usize, usize),
#[error("Failed to parse UTF-8 string: {0}")]
StringParseError(#[source] Utf8Error),
#[error("Invalid char found in u32")]
InvalidU32ForCharError,
}