mf_file/
error.rs

1use std::io;
2
3#[derive(thiserror::Error, Debug)]
4pub enum FileError {
5    #[error("IO 错误: {0}")]
6    Io(#[from] io::Error),
7    #[error("文件头无效或格式错误")]
8    BadHeader,
9    #[error("记录过大: {0}")]
10    RecordTooLarge(usize),
11    #[error("记录为空")]
12    EmptyRecord,
13    #[error("CRC 校验失败,偏移量 {0}")]
14    CrcMismatch(u64),
15}
16
17pub type Result<T> = anyhow::Result<T, FileError>;