This repository was archived by the owner on Aug 16, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -19,13 +19,13 @@ provides a few unique features:
19
19
Add this to Cargo.toml, under ` [dependencies] ` :
20
20
21
21
``` toml
22
- error-chain = " 0.4 "
22
+ error-chain = " 0.5 "
23
23
```
24
24
25
25
Write this at the top of your crate:
26
26
27
27
``` rust
28
- #![recursion_limit = " 1024" ];
28
+ #![recursion_limit = " 1024" ]
29
29
```
30
30
31
31
Again near the top of your crate, import the ` error_chain ` crate and its macros:
@@ -60,7 +60,7 @@ the `error_chain!` macro, and start chaining errors!
60
60
``` rust
61
61
fn do_error_prone_work () -> Result <()> {
62
62
let file = try ! (File :: open (" foo" ). chain_err (|| " couldn't open file" ));
63
- try ! (file . write_str (" important" ). chain_err (|| " couldn't write file" ));
63
+ try ! (file . write_all (" important" . as_bytes () ). chain_err (|| " couldn't write file" ));
64
64
65
65
Ok (())
66
66
}
Original file line number Diff line number Diff line change 59
59
//! Add this to Cargo.toml, under `[dependencies]`:
60
60
//!
61
61
//! ```toml
62
- //! error-chain = "0.4 "
62
+ //! error-chain = "0.5 "
63
63
//! ```
64
64
//!
65
65
//! Write this at the top of your crate:
66
66
//!
67
67
//! ```ignore
68
- //! #![recursion_limit = "1024"];
68
+ //! #![recursion_limit = "1024"]
69
69
//! ```
70
70
//!
71
71
//! Again near the top of your crate, import the `error_chain` crate and its macros:
100
100
//! ```ignore
101
101
//! fn do_error_prone_work() -> Result<()> {
102
102
//! let file = try!(File::open("foo").chain_err(|| "couldn't open file"));
103
- //! try!(file.write_str ("important").chain_err(|| "couldn't write file"));
103
+ //! try!(file.write_all ("important".as_bytes() ).chain_err(|| "couldn't write file"));
104
104
//!
105
105
//! Ok(())
106
106
//! }
You can’t perform that action at this time.
0 commit comments