Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | 03-May-2022 | - | ||||
styles/ | H | 03-May-2022 | - | 12 | 9 | |
Clone.md | H A D | 23-Jan-2021 | 1.6 KiB | 39 | 29 | |
Debug.md | H A D | 23-Jan-2021 | 3.9 KiB | 153 | 125 | |
Default.md | H A D | 23-Jan-2021 | 2.5 KiB | 107 | 84 | |
Hash.md | H A D | 23-Jan-2021 | 2.1 KiB | 84 | 67 | |
README.md | H A D | 23-Jan-2021 | 2 KiB | 126 | 94 | |
SUMMARY.md | H A D | 23-Jan-2021 | 1.2 KiB | 26 | 24 | |
cmp.md | H A D | 23-Jan-2021 | 3.7 KiB | 123 | 96 | |
custom.css | H A D | 23-Jan-2021 | 369 | 24 | 19 | |
debug-transparent-orig.rs | H A D | 23-Jan-2021 | 185 | 8 | 7 | |
debug-transparent.rs | H A D | 23-Jan-2021 | 144 | 5 | 5 | |
default-enum-orig.rs | H A D | 23-Jan-2021 | 307 | 20 | 15 | |
default-enum.rs | H A D | 23-Jan-2021 | 224 | 11 | 9 | |
default-value-orig.rs | H A D | 23-Jan-2021 | 703 | 27 | 26 | |
default-value.rs | H A D | 23-Jan-2021 | 532 | 18 | 18 | |
eq-ignore-orig.rs | H A D | 23-Jan-2021 | 1.1 KiB | 40 | 27 | |
eq-ignore.rs | H A D | 23-Jan-2021 | 784 | 26 | 15 |
README.md
1# Derivative 2 3This crate provides a set of alternative `#[derive]` attributes for Rust. 4 5## Examples 6 7*derivative* uses attributes to make it possible to derive more implementations 8than the built-in `derive(Trait)`. Here are a few examples of stuffs you cannot 9just `derive`. 10 11You can derive `Default` on enumerations: 12 13<table> 14<tr> 15<th> 16 17With *derivative* 18</th> 19<th> 20 21[Original][default-value-source] 22</th> 23</tr> 24<tr> 25</tr> 26<tr class="readme-example"> 27<td> 28 29{{#playground default-enum.rs}} 30</td> 31<td> 32 33{{#playground default-enum-orig.rs}} 34</td> 35</tr> 36</table> 37 38You can use different default values for some fields: 39 40<table> 41<tr> 42<th> 43 44With *derivative* 45</th> 46<th> 47 48[Original][default-value-source] 49</th> 50</tr> 51<tr> 52</tr> 53<tr class="readme-example"> 54<td> 55 56{{#playground default-value.rs}} 57</td> 58<td> 59 60{{#playground default-value-orig.rs}} 61</td> 62</tr> 63</table> 64 65 66Want a transparent `Debug` implementation for your wrapper? We got that: 67 68<table> 69<tr> 70<th> 71 72With *derivative* 73</th> 74<th> 75 76[Original][transparent-source] 77</th> 78</tr> 79<tr> 80</tr> 81<tr class="readme-example"> 82<td> 83 84{{#playground debug-transparent.rs}} 85</td> 86<td> 87 88{{#playground debug-transparent-orig.rs}} 89</td> 90</tr> 91</table> 92 93 94Need to ignore a field? We got that too: 95 96<table> 97<tr> 98<th> 99 100With *derivative* 101</th> 102<th> 103 104[Original][eq-ignore-source] 105</th> 106</tr> 107<tr> 108</tr> 109<tr class="readme-example"> 110<td> 111 112{{#playground eq-ignore.rs}} 113</td> 114<td> 115 116{{#playground eq-ignore-orig.rs}} 117</td> 118</tr> 119</table> 120 121 122[default-value-source]: https://github.com/rust-lang-nursery/regex/blob/3cfef1e79d135a3e8a670aff53e7fabef453a3e1/src/re_builder.rs#L12-L39 123[default-enum-source]: https://github.com/rust-lang/rust/blob/16eeeac783d2ede28e09f2a433c612dea309fe33/src/libcore/option.rs#L714-L718 124[transparent-source]: https://github.com/rust-lang/rust/blob/5457c35ece57bbc4a65baff239a02d6abb81c8a2/src/libcore/num/mod.rs#L46-L54 125[eq-ignore-source]: https://github.com/steveklabnik/semver/blob/baa0fbb57c80a7fb344fbeedac24a28439ddf5b5/src/version.rs#L196-L205 126