reflex/storage/mmap/
error.rs1use std::io;
2use thiserror::Error;
3
4#[derive(Error, Debug)]
5pub enum MmapError {
7 #[error("I/O error: {0}")]
9 Io(#[from] io::Error),
10
11 #[error("File size {actual} is smaller than minimum {expected}")]
13 FileTooSmall {
14 expected: usize,
16 actual: usize,
18 },
19
20 #[error("Cannot mmap empty file")]
22 EmptyFile,
23
24 #[error("rkyv validation failed: {0}")]
26 ValidationFailed(String),
27
28 #[error("Data at offset {offset} is not aligned to {alignment} bytes")]
30 AlignmentError {
31 offset: usize,
33 alignment: usize,
35 },
36
37 #[error("Failed to resize file: {0}")]
39 ResizeFailed(String),
40}
41
42pub type MmapResult<T> = Result<T, MmapError>;