mirror of
https://github.com/phil-opp/blog_os.git
synced 2025-12-16 22:37:49 +00:00
Fix syntax errors in first construct_buffer() version
This commit is contained in:
@@ -214,12 +214,15 @@ So how do we create a `Buffer` instance? The naive approach does not work unfort
|
|||||||
|
|
||||||
```rust
|
```rust
|
||||||
fn construct_buffer() -> Buffer {
|
fn construct_buffer() -> Buffer {
|
||||||
let empty_char = ScreenChar {
|
|
||||||
ascii_character: b' ',
|
|
||||||
color_code: ColorCode::new(Color)
|
|
||||||
}
|
|
||||||
Buffer {
|
Buffer {
|
||||||
chars: [[Volatile::new(empty_char); BUFFER_WIDTH]; BUFFER_HEIGHT],
|
chars: [[Volatile::new(empty_char()); BUFFER_WIDTH]; BUFFER_HEIGHT],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn empty_char() -> ScreenChar {
|
||||||
|
ScreenChar {
|
||||||
|
ascii_character: b' ',
|
||||||
|
color_code: ColorCode::new(Color::Green, Color::Brown),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
@@ -271,13 +274,6 @@ fn construct_buffer() -> Buffer {
|
|||||||
chars: array_init(|_| array_init(|_| Volatile::new(empty_char()))),
|
chars: array_init(|_| array_init(|_| Volatile::new(empty_char()))),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn empty_char() -> ScreenChar {
|
|
||||||
ScreenChar {
|
|
||||||
ascii_character: b' ',
|
|
||||||
color_code: ColorCode::new(Color::Green, Color::Brown),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
See the [documentation of `array_init`][`array_init`] for more information about using that crate.
|
See the [documentation of `array_init`][`array_init`] for more information about using that crate.
|
||||||
|
|||||||
Reference in New Issue
Block a user