mirror of
https://github.com/phil-opp/blog_os.git
synced 2025-12-16 14:27:49 +00:00
Implement fmt::Write trait for Writer
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
// limitations under the License.
|
||||
|
||||
#![feature(no_std, lang_items)]
|
||||
#![feature(const_fn, unique)]
|
||||
#![feature(const_fn, unique, core_str_ext)]
|
||||
#![no_std]
|
||||
|
||||
extern crate rlibc;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
use core::ptr::Unique;
|
||||
use core::fmt;
|
||||
use spin::Mutex;
|
||||
|
||||
const BUFFER_HEIGHT: usize = 25;
|
||||
@@ -78,6 +79,15 @@ impl Writer {
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Write for Writer {
|
||||
fn write_str(&mut self, s: &str) -> ::core::fmt::Result {
|
||||
for byte in s.bytes() {
|
||||
self.write_byte(byte)
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
struct ColorCode(u8);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user