File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change 1
1
# What ` #[derive(Constructor)] ` generates
2
2
3
3
A common pattern in Rust is to create a static constructor method called
4
- ` new ` . This method is can then be used to create an instance of a struct. You
4
+ ` new ` . This method can then be used to create an instance of a struct. You
5
5
can now derive this method by using ` #[derive(Constructor)] ` , even though
6
- ` Constructor ` it is not an actual trait. The generated ` new ` method is very
6
+ ` Constructor ` is not an actual trait. The generated ` new ` method is very
7
7
similar to the ` from ` method when deriving ` From ` , except that it takes multiple
8
8
arguments instead of a tuple.
9
9
@@ -12,7 +12,7 @@ arguments instead of a tuple.
12
12
13
13
## Tuple structs
14
14
15
- When deriving ` Constructor ` for a tuple struct with a two fields like this:
15
+ When deriving ` Constructor ` for a tuple struct with two fields like this:
16
16
17
17
``` rust
18
18
# use derive_more :: Constructor ;
You can’t perform that action at this time.
0 commit comments