Skip to content

Commit 4dee364

Browse files
gibbyfreeehuss
authored andcommitted
fix compile errors in code snippets
1 parent 1c56d59 commit 4dee364

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

src/attributes/debugger.md

+19-3
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,26 @@ Where `main.rs` contains:
3030

3131
```rust ignore
3232
#![debugger_visualizer(natvis_file = "../Rectangle.natvis")]
33-
struct FancyRect {
33+
mod fancy_rect {
34+
pub struct FancyRect {
3435
pub x: f32,
3536
pub y: f32,
3637
pub dx: f32,
3738
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+
}
3846
}
3947

48+
use fancy_rect::FancyRect;
49+
4050
fn main() {
4151
let fancy_rect = FancyRect::new(10.0, 10.0, 5.0, 5.0);
42-
Ok(());
52+
()
4353
}
4454
```
4555

@@ -108,13 +118,19 @@ mod person {
108118
pub name: String,
109119
pub age: i32,
110120
}
121+
122+
impl Person {
123+
pub fn new(name: String, age: i32) -> Self {
124+
Person { name, age }
125+
}
126+
}
111127
}
112128

113129
use person::Person;
114130

115131
fn main() {
116132
let bob = Person::new(String::from("Bob"), 10);
117-
Ok(());
133+
()
118134
}
119135
```
120136

0 commit comments

Comments
 (0)