File tree 2 files changed +6
-3
lines changed
2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ mod derived_display;
3
3
4
4
fn main ( ) {
5
5
no_derive ( ) ;
6
+ derive ( ) ;
6
7
}
7
8
8
9
fn no_derive ( ) {
@@ -23,12 +24,12 @@ fn derive() {
23
24
// https://crates.io/crates/parse-display-derive
24
25
println ! ( "Derived Display method" ) ;
25
26
26
- let s = derived_display:: MyStruct :: new ( 10 , 20 ) ;
27
- println ! ( "{}" , s) ;
28
-
29
27
let a = derived_display:: MyEnum :: VarA ;
30
28
let b = derived_display:: MyEnum :: VarB ;
31
29
println ! ( "{}" , a) ;
32
30
println ! ( "{}" , b) ;
31
+
32
+ let s = derived_display:: MyStruct :: new ( 10 , 20 ) ;
33
+ println ! ( "{}" , s) ;
33
34
println ! ( ) ;
34
35
}
Original file line number Diff line number Diff line change 1
1
use std:: fmt;
2
2
3
+ #[ derive( Debug , Clone , Copy , PartialEq ) ]
3
4
pub enum MyEnum {
4
5
VarA ,
5
6
VarB ,
@@ -20,6 +21,7 @@ impl fmt::Display for MyEnum {
20
21
}
21
22
}
22
23
24
+ #[ derive( Debug , Clone , Copy , PartialEq ) ]
23
25
pub struct MyStruct {
24
26
a : u32 ,
25
27
b : u32 ,
You can’t perform that action at this time.
0 commit comments