#[non_exhaustive]pub enum DocError {
Io(Error),
Zip(String),
Format(String),
Template {
placeholder: String,
message: String,
},
Conversion {
field: String,
value: String,
message: String,
},
Unsupported(String),
Document(String),
}Expand description
库统一错误枚举。
Java EasyExcel 将错误分散在七个 RuntimeException 子类中;
本枚举将它们合并为一个惯用的 Rust 类型。
对应 Java: com.alibaba.excel.exception.ExcelAnalysisException、
ExcelGenerateException、ExcelDataConvertException 等
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Io(Error)
I/O 错误,包装 std::io::Error。
对应 Java: IOException
Zip(String)
ZIP 包错误(来自 docx-rs 打包)。
对应 Java: ExcelAnalysisException 中的 ZIP 相关错误
Format(String)
无效或不支持的文档格式。
对应 Java: ExcelAnalysisException("The supplied file was not supported")
Template
模板占位符无法解析或处理。
对应 Java: ExcelAnalysisException 中的模板相关错误(easyexcel-template)
Conversion
单元格或字段值无法与目标类型互转。
对应 Java: com.alibaba.excel.exception.ExcelDataConvertException
Unsupported(String)
请求的操作不被当前格式或配置支持。
对应 Java: UnsupportedOperationException
Document(String)
通用文档级错误。
对应 Java: ExcelAnalysisException / ExcelGenerateException
Trait Implementations§
Source§impl Error for DocError
impl Error for DocError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Auto Trait Implementations§
impl !RefUnwindSafe for DocError
impl !UnwindSafe for DocError
impl Freeze for DocError
impl Send for DocError
impl Sync for DocError
impl Unpin for DocError
impl UnsafeUnpin for DocError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more