Add a print_error function, which works for exceptions inside println

This commit is contained in:
Philipp Oppermann
2016-05-28 15:41:16 +02:00
parent c1df1d3354
commit f58a6fe185
3 changed files with 18 additions and 3 deletions

View File

@@ -38,6 +38,19 @@ pub fn clear_screen() {
}
}
pub unsafe fn print_error(fmt: fmt::Arguments) {
use core::fmt::Write;
let mut writer = Writer {
column_position: 0,
color_code: ColorCode::new(Color::Red, Color::Black),
buffer: Unique::new(0xb8000 as *mut _),
};
writer.new_line();
writer.write_fmt(fmt);
}
#[allow(dead_code)]
#[repr(u8)]
pub enum Color {