1# Derivative
2
3[![Crates.io](https://img.shields.io/crates/v/derivative.svg?maxAge=3600)](https://crates.io/crates/derivative)
4[![Crates.io](https://img.shields.io/crates/l/derivative.svg?maxAge=3600)](https://github.com/mcarton/rust-derivative#license)
5![Continuous integration](https://github.com/mcarton/rust-derivative/workflows/Continuous%20integration/badge.svg)
6
7This crate provides a set of alternative customizable `#[derive]` attributes for Rust.
8
9## [Documentation][documentation]
10## Stability
11
12This crate is stable and follows semver. It requires *rustc 1.34 or later* and changing the minimal rustc version will be considered a semver breaking change.
13
14## What it does
15
16```rust
17#[derive(Derivative)]
18#[derivative(Debug)]
19struct Foo {
20    foo: u8,
21    #[derivative(Debug="ignore")]
22    bar: u8,
23}
24
25// Prints `Foo { foo: 42 }`
26println!("{:?}", Foo { foo: 42, bar: 1 });
27```
28
29Check the [documentation] for more!
30
31## License
32
33Licensed under either of
34 * Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or
35   <http://www.apache.org/licenses/LICENSE-2.0>)
36 * MIT license ([LICENSE-MIT](LICENSE-MIT) or <http://opensource.org/licenses/MIT>)
37
38at your option.
39
40## Acknowledgements
41
42This is inspired from how [`serde`] wonderfully handles attributes.
43This also takes some code and ideas from `serde` itself.
44
45Some tests are directly adapted from `rustc`'s tests.
46
47## Contribution
48
49Unless you explicitly state otherwise, any contribution intentionally submitted
50for inclusion in the work by you, as defined in the Apache-2.0 license, shall
51be dual licensed as above, without any additional terms or conditions.
52
53[`serde`]: https://crates.io/crates/serde
54[documentation]: https://mcarton.github.io/rust-derivative/latest/index.html
55[rustc]: https://github.com/rust-lang/rust
56