gecko-dev/third_party/rust/quick-error
Nathan Froyd b93bf873ba Bug 1502964 - part 2 - update winapi to froydnj/winapi-rs#aarch64; r=ted.mielczarek 2018-11-02 10:56:08 -04:00
..
examples No bug - Revendor rust dependencies 2018-03-28 20:23:10 +00:00
src No bug - Revendor rust dependencies 2018-03-28 20:23:10 +00:00
.cargo-checksum.json Bug 1502964 - part 2 - update winapi to froydnj/winapi-rs#aarch64; r=ted.mielczarek 2018-11-02 10:56:08 -04:00
Cargo.toml No bug - Revendor rust dependencies 2018-03-28 20:23:10 +00:00
LICENSE-APACHE No bug - Revendor rust dependencies 2018-03-28 20:23:10 +00:00
LICENSE-MIT No bug - Revendor rust dependencies 2018-03-28 20:23:10 +00:00
README.rst No bug - Revendor rust dependencies 2018-03-28 20:23:10 +00:00
bulk.yaml No bug - Revendor rust dependencies 2018-03-28 20:23:10 +00:00
vagga.yaml No bug - Revendor rust dependencies 2018-03-28 20:23:10 +00:00

README.rst

===========
Quick Error
===========

:Status: production-ready
:Documentation: http://tailhook.github.io/quick-error/

A macro which makes error types pleasant to write.

Features:

* Define enum type with arbitrary parameters
* Concise notation of ``Display`` and ``Error`` traits
* Full control of ``Display`` and ``Error`` trait implementation
* Any number of ``From`` traits
* Support for all enum-variants ``Unit``, ``Tuple`` and ``Struct``

Here is the comprehensive example:

.. code-block:: rust

    quick_error! {
        #[derive(Debug)]
        pub enum IoWrapper {
            Io(err: io::Error) {
                from()
                description("io error")
                display("I/O error: {}", err)
                cause(err)
            }
            Other(descr: &'static str) {
                description(descr)
                display("Error {}", descr)
            }
            IoAt { place: &'static str, err: io::Error } {
                cause(err)
                display(me) -> ("{} {}: {}", me.description(), place, err)
                description("io error at")
                from(s: String) -> {
                    place: "some string",
                    err: io::Error::new(io::ErrorKind::Other, s)
                }
            }
            Discard {
                from(&'static str)
            }
        }
    }

=======
License
=======

Licensed under either of

 * Apache License, Version 2.0, (./LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
 * MIT license (./LICENSE-MIT or http://opensource.org/licenses/MIT)

at your option.

------------
Contribution
------------

Unless you explicitly state otherwise, any contribution intentionally
submitted for inclusion in the work by you, as defined in the Apache-2.0
license, shall be dual licensed as above, without any additional terms or
conditions.