1=========== 2Quick Error 3=========== 4 5:Status: production-ready 6:Documentation: http://tailhook.github.io/quick-error/ 7 8A macro which makes error types pleasant to write. 9 10Features: 11 12* Define enum type with arbitrary parameters 13* Concise notation of ``Display`` and ``Error`` traits 14* Full control of ``Display`` and ``Error`` trait implementation 15* Any number of ``From`` traits 16* Support for all enum-variants ``Unit``, ``Tuple`` and ``Struct`` 17 18Here is the comprehensive example: 19 20.. code-block:: rust 21 22 quick_error! { 23 #[derive(Debug)] 24 pub enum IoWrapper { 25 Io(err: io::Error) { 26 from() 27 display("I/O error: {}", err) 28 cause(err) 29 } 30 Other(descr: &'static str) { 31 display("Error {}", descr) 32 } 33 IoAt { place: &'static str, err: io::Error } { 34 cause(err) 35 display(me) -> ("io error at {}: {}", place, err) 36 from(s: String) -> { 37 place: "some string", 38 err: io::Error::new(io::ErrorKind::Other, s) 39 } 40 } 41 Discard { 42 from(&'static str) 43 } 44 } 45 } 46 47======= 48License 49======= 50 51Licensed under either of 52 53 * Apache License, Version 2.0, (./LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0) 54 * MIT license (./LICENSE-MIT or http://opensource.org/licenses/MIT) 55 56at your option. 57 58------------ 59Contribution 60------------ 61 62Unless you explicitly state otherwise, any contribution intentionally 63submitted for inclusion in the work by you, as defined in the Apache-2.0 64license, shall be dual licensed as above, without any additional terms or 65conditions. 66 67