Create and use real error types in the codecs

This commit is contained in:
Clément Renault 2023-11-28 10:11:17 +01:00
parent d32eb11329
commit 548c8247c2
No known key found for this signature in database
GPG key ID: F250A4C4E3AE5F5F
7 changed files with 43 additions and 38 deletions

View file

@ -15,6 +15,7 @@ mod str_str_u8_codec;
pub use byte_slice_ref::BytesRefCodec;
use heed::BoxedError;
pub use str_ref::StrRefCodec;
use thiserror::Error;
pub use self::beu16_str_codec::BEU16StrCodec;
pub use self::beu32_str_codec::BEU32StrCodec;
@ -34,3 +35,7 @@ pub trait BytesDecodeOwned {
fn bytes_decode_owned(bytes: &[u8]) -> Result<Self::DItem, BoxedError>;
}
#[derive(Error, Debug)]
#[error("the slice is too short")]
pub struct SliceTooShortError;