【文件属性】:
文件名称:thiserror:struct和枚举错误类型的derive(Error)
文件大小:46KB
文件格式:ZIP
更新时间:2021-05-08 16:34:54
Rust
派生(错误)
该库为标准库的特性提供了一个方便的派生宏。
[ dependencies ]
thiserror = " 1.0 "
编译器支持:需要rustc 1.31+
例子
use thiserror :: Error;
#[derive(Error, Debug)]
pub enum DataStoreError {
#[error( "data store disconnected" )]
Disconnect (#[from] io :: Error),
#[error( "the data for key `{0}` is not available" )]
Redaction ( String ),
#[error( "invalid header (expected {expected:?}, found {found:?})"
【文件预览】:
thiserror-master
----.gitignore(30B)
----src()
--------aserror.rs(658B)
--------lib.rs(7KB)
--------display.rs(526B)
----Cargo.toml(618B)
----.github()
--------workflows()
----impl()
--------src()
--------Cargo.toml(419B)
--------LICENSE-MIT(14B)
--------LICENSE-APACHE(17B)
----LICENSE-MIT(1023B)
----README.md(7KB)
----tests()
--------compiletest.rs(181B)
--------test_error.rs(1KB)
--------test_source.rs(1KB)
--------test_display.rs(5KB)
--------test_transparent.rs(1KB)
--------test_expr.rs(2KB)
--------test_path.rs(906B)
--------test_lints.rs(417B)
--------ui()
--------test_deprecated.rs(173B)
--------test_from.rs(700B)
--------test_backtrace.rs(5KB)
--------test_option.rs(2KB)
----.clippy.toml(16B)
----LICENSE-APACHE(11KB)