mirror of
https://github.com/phil-opp/blog_os.git
synced 2025-12-16 14:27:49 +00:00
Add missing use statements in printing-to-screen (#154)
This commit is contained in:
committed by
Philipp Oppermann
parent
a9f41d7303
commit
07d534e4b4
@@ -132,6 +132,8 @@ Since the field ordering in default structs is undefined in Rust, we need the [r
|
|||||||
To actually write to screen, we now create a writer type:
|
To actually write to screen, we now create a writer type:
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
|
use core::ptr::Unique;
|
||||||
|
|
||||||
pub struct Writer {
|
pub struct Writer {
|
||||||
column_position: usize,
|
column_position: usize,
|
||||||
color_code: ColorCode,
|
color_code: ColorCode,
|
||||||
@@ -256,6 +258,7 @@ Now we can use Rust's built-in `write!`/`writeln!` formatting macros:
|
|||||||
|
|
||||||
```rust
|
```rust
|
||||||
// in the `print_something` function
|
// in the `print_something` function
|
||||||
|
use core::fmt::Write;
|
||||||
let mut writer = Writer {...};
|
let mut writer = Writer {...};
|
||||||
writer.write_byte(b'H');
|
writer.write_byte(b'H');
|
||||||
writer.write_str("ello! ");
|
writer.write_str("ello! ");
|
||||||
|
|||||||
Reference in New Issue
Block a user