File: README.rst

package info (click to toggle)
firefox 147.0.2-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 4,683,484 kB
  • sloc: cpp: 7,607,246; javascript: 6,533,185; ansic: 3,775,227; python: 1,415,393; xml: 634,561; asm: 438,951; java: 186,241; sh: 62,752; makefile: 18,079; objc: 13,092; perl: 12,808; yacc: 4,583; cs: 3,846; pascal: 3,448; lex: 1,720; ruby: 1,003; php: 436; lisp: 258; awk: 247; sql: 66; sed: 54; csh: 10; exp: 6
file content (66 lines) | stat: -rw-r--r-- 1,740 bytes parent folder | download | duplicates (65)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
===========
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()
                display("I/O error: {}", err)
                cause(err)
            }
            Other(descr: &'static str) {
                display("Error {}", descr)
            }
            IoAt { place: &'static str, err: io::Error } {
                cause(err)
                display(me) -> ("io error at {}: {}", place, err)
                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.