rustdesk/vendor/derivative/doc
2024-10-11 18:43:02 +03:00
..
styles Performed vendorization 2024-10-11 18:43:02 +03:00
Clone.md Performed vendorization 2024-10-11 18:43:02 +03:00
cmp.md Performed vendorization 2024-10-11 18:43:02 +03:00
custom.css Performed vendorization 2024-10-11 18:43:02 +03:00
debug-transparent-orig.rs Performed vendorization 2024-10-11 18:43:02 +03:00
debug-transparent.rs Performed vendorization 2024-10-11 18:43:02 +03:00
Debug.md Performed vendorization 2024-10-11 18:43:02 +03:00
default-enum-orig.rs Performed vendorization 2024-10-11 18:43:02 +03:00
default-enum.rs Performed vendorization 2024-10-11 18:43:02 +03:00
default-value-orig.rs Performed vendorization 2024-10-11 18:43:02 +03:00
default-value.rs Performed vendorization 2024-10-11 18:43:02 +03:00
Default.md Performed vendorization 2024-10-11 18:43:02 +03:00
eq-ignore-orig.rs Performed vendorization 2024-10-11 18:43:02 +03:00
eq-ignore.rs Performed vendorization 2024-10-11 18:43:02 +03:00
Hash.md Performed vendorization 2024-10-11 18:43:02 +03:00
README.md Performed vendorization 2024-10-11 18:43:02 +03:00
SUMMARY.md Performed vendorization 2024-10-11 18:43:02 +03:00

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}}