derivative

A set of alternative `derive` attributes for Rust

Latest version: 2.2.0 registry icon
Maintenance score
0
Safety score
0
Popularity score
75
Check your open source dependency risks. Get immediate insight about security, stability and licensing risks.
Security
  Vulnerabilities
Version Suggest Low Medium High Critical
2.2.0 0 0 1 0 0
2.1.3 0 0 1 0 0
2.1.2 0 0 1 0 0
2.1.1 0 0 1 0 0
2.1.0 0 0 1 0 0
2.0.2 0 0 1 0 0
2.0.1 0 0 1 0 0
2.0.0 0 0 1 0 0
1.0.4 0 0 1 0 0
1.0.3 0 0 1 0 0
1.0.2 0 0 1 0 0
1.0.1 0 0 1 0 0
1.0.0 0 0 1 0 0
0.3.1 0 0 1 0 0
0.3.0 0 0 1 0 0
0.2.0 0 0 1 0 0
0.1.0 0 0 1 0 0
0.0.3 0 0 1 0 0
0.0.2 0 0 1 0 0
0.0.1 0 0 1 0 0

Stability
Latest release:

2.2.0 - This version may not be safe as it has not been updated for a long time. Find out if your coding project uses this component and get notified of any reported security vulnerabilities with Meterian-X Open Source Security Platform

Licensing

Maintain your licence declarations and avoid unwanted licences to protect your IP the way you intended.

Apache-2.0   -   Apache License 2.0

Not a wildcard

Not proprietary

OSI Compliant


MIT   -   MIT License

Not a wildcard

Not proprietary

OSI Compliant



Derivative

Crates.io Crates.io Continuous integration

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

Stability

This 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.

What it does

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

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

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.