File tree 1 file changed +19
-3
lines changed
1 file changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -30,16 +30,26 @@ Where `main.rs` contains:
30
30
31
31
``` rust ignore
32
32
#![debugger_visualizer(natvis_file = " ../Rectangle.natvis" )]
33
- struct FancyRect {
33
+ mod fancy_rect {
34
+ pub struct FancyRect {
34
35
pub x : f32 ,
35
36
pub y : f32 ,
36
37
pub dx : f32 ,
37
38
pub dy : f32 ,
39
+ }
40
+
41
+ impl FancyRect {
42
+ pub fn new (x : f32 , y : f32 , dx : f32 , dy : f32 ) -> Self {
43
+ FancyRect { x , y , dx , dy }
44
+ }
45
+ }
38
46
}
39
47
48
+ use fancy_rect :: FancyRect ;
49
+
40
50
fn main () {
41
51
let fancy_rect = FancyRect :: new (10.0 , 10.0 , 5.0 , 5.0 );
42
- Ok (());
52
+ ()
43
53
}
44
54
```
45
55
@@ -108,13 +118,19 @@ mod person {
108
118
pub name : String ,
109
119
pub age : i32 ,
110
120
}
121
+
122
+ impl Person {
123
+ pub fn new (name : String , age : i32 ) -> Self {
124
+ Person { name , age }
125
+ }
126
+ }
111
127
}
112
128
113
129
use person :: Person ;
114
130
115
131
fn main () {
116
132
let bob = Person :: new (String :: from (" Bob" ), 10 );
117
- Ok (());
133
+ ()
118
134
}
119
135
```
120
136
You can’t perform that action at this time.
0 commit comments