add more traits and macros

Namely:
* ChainErrorFrom
* IntoChainError
* minto_cherr!
* into_cherr!
* strerr!

Also make derive_str_cherr! struct public
This commit is contained in:
Harald Hoyer 2019-01-08 15:33:12 +01:00
parent f972b5f703
commit a040044529
4 changed files with 104 additions and 5 deletions

View file

@ -30,6 +30,7 @@ impl ::std::fmt::Display for Func1ErrorKind {
}
}
}
impl ::std::error::Error for Func1ErrorKind {}
fn func1() -> ChainResult<(), Func1ErrorKind> {
func2().map_err(|e| cherr!(e, Func1ErrorKind::Func2))?;

View file

@ -36,6 +36,8 @@ impl ::std::fmt::Debug for Func1ErrorKind {
}
}
impl ::std::error::Error for Func1ErrorKind {}
fn func1() -> ChainResult<(), Func1ErrorKind> {
func2().map_err(|e| cherr!(e, Func1ErrorKind::Func2))?;
let filename = String::from("bar.txt");