Skip to content
A set of alternative `derive` attributes for Rust
Rust Makefile
Branch: master
Clone or download
mcarton Delete rustfmt.toml
Let's stick to the default configuration.
Latest commit 5ae882d Aug 31, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github/ISSUE_TEMPLATE Update issue templates Aug 31, 2019
doc Document `PartialOrd` and `Ord` deriving Aug 31, 2019
src Implement deriving `PartialOrd` and `Ord` Aug 31, 2019
tests Implement deriving `PartialOrd` and `Ord` Aug 31, 2019
.gitignore Merge branch 'doc' Oct 7, 2016
.travis.yml Fix travis build Aug 22, 2019
CHANGELOG.md
CONTRIBUTING.md Add CONTRIBUTING.md Oct 8, 2016
Cargo.toml Update to 1.0.3 Aug 28, 2019
LICENSE-APACHE Add license files Oct 7, 2016
LICENSE-MIT Add license files Oct 7, 2016
Makefile Add `use_core` feature Nov 7, 2018
README.md Use badge from travis Aug 27, 2019
appveyor.yml Try to fix CI on nightly Nov 7, 2018
book.json

README.md

Derivative

Travis Build status Crates.io Crates.io

This crate provides a set of alternative #[derive] attributes for Rust.

Documentation

Stability

This crate is now stable and usable on rustc stable too!

Note that you need rustc 1.15 or later.

What it does

#[derive(Derivative)]
#[derivative(Debug)]
struct Foo {
    foo: u8,
    #[derivative(Debug="ignore")]
    bar: u8,
}

println!("{:?}", Foo { foo: 42, bar: 1 }); // Foo { foo: 42 }

Check the documentation for more!

License

Licensed under either of

at your option.

Acknowledgements

This is inspired from how serde wonderfully handles attributes. This also takes some code and ideas from serde itself.

Some tests are directly adapted from rustc's tests.

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.

You can’t perform that action at this time.