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
use std::ffi::NulError;
use std::result;
use thiserror::Error;
#[derive(Error, Debug, Eq, PartialEq)]
pub enum Error {
#[error("The requested key wasn't found in the map")]
KeyNotFound,
#[error("The requested index was out of bounds")]
IndexOutOfBounds,
#[error("The given/requested value type doesn't match the type of the property")]
WrongValueType,
#[error("The key is invalid")]
InvalidKey(#[from] InvalidKeyError),
#[error("Couldn't convert to a CString")]
CStringConversion(#[from] NulError),
}
pub type Result<T> = result::Result<T, Error>;
#[derive(Error, Debug, Eq, PartialEq)]
#[rustfmt::skip]
pub enum InvalidKeyError {
#[error("The key is empty")]
EmptyKey,
#[error("The key contains an invalid character at index {}", _0)]
InvalidCharacter(usize),
}