trackable
provides functionalities to define trackable objects and track those.
Below code is an example that tracks failure of an I/O operation:
```rust
extern crate trackable;
use trackable::error::Failure;
fn foo() -> Result<(), Failure> { track!(std::fs::File::open("/path/to/nonexistentfile").maperr(Failure::fromerror))?; Ok(()) } fn bar() -> Result<(), Failure> { track!(foo())?; Ok(()) } fn baz() -> Result<(), Failure> { track!(bar())?; Ok(()) }
fn main() { let result = baz(); assert!(result.is_err());
let error = result.err().unwrap();
assert_eq!(format!("\r{}", error), r#"
Failed (cause; No such file or directory)
HISTORY:
[0] at rustout:
This example used the built-in Failure
type, but you can easily define your own trackable error types.
See the documentaion of error module for more details.