add quick_error
This commit is contained in:
22
quick_error/src/main.rs
Normal file
22
quick_error/src/main.rs
Normal file
@@ -0,0 +1,22 @@
|
||||
#[macro_use] extern crate quick_error;
|
||||
|
||||
quick_error! {
|
||||
#[derive(Debug)]
|
||||
pub enum SomeError {
|
||||
Io(m: String) {
|
||||
display("{}", m)
|
||||
}
|
||||
Utf8(err: std::str::Utf8Error) {
|
||||
display("utf8 error")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// https://docs.rs/quick-error/1.2.3/quick_error/
|
||||
fn main() -> Result<(), SomeError> {
|
||||
println!("Hello, world!");
|
||||
|
||||
Err(SomeError::Io("m".to_owned()))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user