mirror of
https://github.com/phil-opp/blog_os.git
synced 2025-12-16 14:27: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
|
||||
fn construct_buffer() -> Buffer {
|
||||
let empty_char = ScreenChar {
|
||||
ascii_character: b' ',
|
||||
color_code: ColorCode::new(Color)
|
||||
}
|
||||
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()))),
|
||||
}
|
||||
}
|
||||
|
||||
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.
|
||||
|
||||
Reference in New Issue
Block a user