abrasion/third_party/cargo/vendor/derivative-2.2.0/doc
q3k 07436668f4 third_party/cargo: update 2021-04-03 16:13:10 +00:00
..
styles third_party/cargo: update 2021-04-03 16:13:10 +00:00
Clone.md third_party/cargo: update 2021-04-03 16:13:10 +00:00
Debug.md third_party/cargo: update 2021-04-03 16:13:10 +00:00
Default.md third_party/cargo: update 2021-04-03 16:13:10 +00:00
Hash.md third_party/cargo: update 2021-04-03 16:13:10 +00:00
README.md third_party/cargo: update 2021-04-03 16:13:10 +00:00
SUMMARY.md third_party/cargo: update 2021-04-03 16:13:10 +00:00
cmp.md third_party/cargo: update 2021-04-03 16:13:10 +00:00
custom.css third_party/cargo: update 2021-04-03 16:13:10 +00:00
debug-transparent-orig.rs third_party/cargo: update 2021-04-03 16:13:10 +00:00
debug-transparent.rs third_party/cargo: update 2021-04-03 16:13:10 +00:00
default-enum-orig.rs third_party/cargo: update 2021-04-03 16:13:10 +00:00
default-enum.rs third_party/cargo: update 2021-04-03 16:13:10 +00:00
default-value-orig.rs third_party/cargo: update 2021-04-03 16:13:10 +00:00
default-value.rs third_party/cargo: update 2021-04-03 16:13:10 +00:00
eq-ignore-orig.rs third_party/cargo: update 2021-04-03 16:13:10 +00:00
eq-ignore.rs third_party/cargo: update 2021-04-03 16:13:10 +00:00

README.md

Derivative

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

Examples

derivative uses attributes to make it possible to derive more implementations than the built-in derive(Trait). Here are a few examples of stuffs you cannot just derive.

You can derive Default on enumerations:

With derivative

Original

{{#playground default-enum.rs}}

{{#playground default-enum-orig.rs}}

You can use different default values for some fields:

With derivative

Original

{{#playground default-value.rs}}

{{#playground default-value-orig.rs}}

Want a transparent Debug implementation for your wrapper? We got that:

With derivative

Original

{{#playground debug-transparent.rs}}

{{#playground debug-transparent-orig.rs}}

Need to ignore a field? We got that too:

With derivative

Original

{{#playground eq-ignore.rs}}

{{#playground eq-ignore-orig.rs}}