@@ -16,7 +16,6 @@ statements, with the only caveat that it requires to derive `DeriveWhere`
16
16
([ #27 ] ):
17
17
18
18
``` rust
19
- #[derive(DeriveWhere )]
20
19
#[derive_where(Clone , Debug )]
21
20
struct Example <T >(PhantomData <T >);
22
21
```
@@ -34,7 +33,6 @@ specified. This example will restrict the implementation for `Example` to
34
33
` T: Clone ` :
35
34
36
35
``` rust
37
- #[derive(DeriveWhere )]
38
36
#[derive_where(Clone ; T )]
39
37
struct Example <T , U >(T , PhantomData <U >);
40
38
```
@@ -45,7 +43,6 @@ bind implementation for `Example` to `T: Super`:
45
43
``` rust
46
44
trait Super : Clone {}
47
45
48
- #[derive(DeriveWhere )]
49
46
#[derive_where(Clone ; T : Super )]
50
47
struct Example <T >(PhantomData <T >);
51
48
```
@@ -65,7 +62,6 @@ impl Trait for Impl {
65
62
type Type = i32 ;
66
63
}
67
64
68
- #[derive(DeriveWhere )]
69
65
#[derive_where(Clone ; T :: Type )]
70
66
struct Example <T : Trait >(T :: Type );
71
67
```
@@ -75,7 +71,6 @@ specific constrain. It is also possible to use multiple separate
75
71
constrain specifications when required:
76
72
77
73
``` rust
78
- #[derive(DeriveWhere )]
79
74
#[derive_where(Clone ; T )]
80
75
#[derive_where(Debug ; U )]
81
76
struct Example <T , U >(PhantomData <T >, PhantomData <U >);
@@ -87,7 +82,6 @@ Deriving [`Default`] on an enum is not possible in Rust at the moment.
87
82
Derive-where allows this with a ` default ` attribute:
88
83
89
84
``` rust
90
- #[derive(DeriveWhere )]
91
85
#[derive_where(Default )]
92
86
enum Example <T > {
93
87
#[derive_where(default)]
@@ -102,7 +96,6 @@ that allow it, which are: [`Debug`], [`Hash`], [`Ord`](https://doc.rust-lang.org
102
96
[ ` PartialEq ` ] ( https://doc.rust-lang.org/core/cmp/trait.PartialEq.html ) , [ ` Zeroize ` ] and [ ` ZeroizeOnDrop ` ] .
103
97
104
98
``` rust
105
- #[derive(DeriveWhere )]
106
99
#[derive_where(Debug , PartialEq ; T )]
107
100
struct Example <T >(#[derive_where(skip)] T );
108
101
@@ -113,14 +106,12 @@ assert_eq!(Example(42), Example(0));
113
106
It is also possible to skip all fields in an item or variant if desired:
114
107
115
108
``` rust
116
- #[derive(DeriveWhere )]
117
109
#[derive_where(Debug )]
118
110
#[derive_where(skip_inner)]
119
111
struct StructExample <T >(T );
120
112
121
113
assert_eq! (format! (" {:?}" , StructExample (42 )), " StructExample" );
122
114
123
- #[derive(DeriveWhere )]
124
115
#[derive_where(Debug )]
125
116
enum EnumExample <T > {
126
117
#[derive_where(skip_inner)]
@@ -134,7 +125,6 @@ Selective skipping of fields for certain traits is also an option, both in
134
125
` skip ` and ` skip_inner ` :
135
126
136
127
``` rust
137
- #[derive(DeriveWhere )]
138
128
#[derive_where(Debug , PartialEq )]
139
129
#[derive_where(skip_inner(Debug ))]
140
130
struct Example <T >(i32 , PhantomData <T >);
@@ -156,7 +146,6 @@ assert_ne!(
156
146
This is to avoid ambiguity between another method also called ` zeroize ` .
157
147
158
148
``` rust
159
- #[derive(DeriveWhere )]
160
149
#[derive_where(Zeroize (crate = " zeroize_" ))]
161
150
struct Example (#[derive_where(Zeroize (fqs))] i32 );
162
151
@@ -189,8 +178,7 @@ and can be implemented without [`Zeroize`], otherwise it only implements
189
178
- ` crate ` : an item-level option which specifies a path to the ` zeroize `
190
179
crate in case of a re-export or rename.
191
180
192
- ```
193
- #[derive(DeriveWhere)]
181
+ ``` rust
194
182
#[derive_where(ZeroizeOnDrop (crate = " zeroize_" ))]
195
183
struct Example (i32 );
196
184
0 commit comments