This commit is contained in:
Paul
2018-03-11 03:08:14 -07:00
committed by Philipp Oppermann
parent 558e9237fd
commit b7b8c5ff61

View File

@@ -576,7 +576,7 @@ pub fn print(args: fmt::Arguments) {
The `print` function locks our static `WRITER` and calls the `write_fmt` method on it. This method is from the `Write` trait, we need to import that trait. The additional `unwrap()` at the end panics if printing isn't successful. But since we always return `Ok` in `write_str`, that should not happen.
### Hello World using `println`
To use `println` in `lib.rs`, we need to import the macros of the VGA buffer module first. Therefore we add a `#[macro_use]` attribute to the module declaration:
To use `println` in `main.rs`, we need to import the macros of the VGA buffer module first. Therefore we add a `#[macro_use]` attribute to the module declaration:
```rust
// in src/main.rs