summaryrefslogtreecommitdiff
path: root/kernel/src/io/panic_screen.rs
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/src/io/panic_screen.rs')
-rw-r--r--kernel/src/io/panic_screen.rs27
1 files changed, 10 insertions, 17 deletions
diff --git a/kernel/src/io/panic_screen.rs b/kernel/src/io/panic_screen.rs
index ce2c118..7b81676 100644
--- a/kernel/src/io/panic_screen.rs
+++ b/kernel/src/io/panic_screen.rs
@@ -1,11 +1,10 @@
-use core::fmt::Write;
-use crate::io::vga_text::{OStream, CharState, Color};
+use crate::io::vga_text::{CharState, Color, OStream};
const PANIC_SCREEN_MESSAGE_BUFFER_SIZE: usize = 2048;
struct TextBuffer<'a> {
dst: &'a mut [u8],
- len: usize
+ len: usize,
}
impl<'a> TextBuffer<'a> {
@@ -23,7 +22,7 @@ impl<'a> core::fmt::Write for TextBuffer<'a> {
Err(core::fmt::Error)
} else {
let s = s.as_bytes();
- (&mut self.dst[self.len..self.len+s.len()]).clone_from_slice(s);
+ (&mut self.dst[self.len..self.len + s.len()]).clone_from_slice(s);
Ok(self.len += s.len())
}
}
@@ -31,27 +30,21 @@ impl<'a> core::fmt::Write for TextBuffer<'a> {
pub fn show(args: Option<&core::fmt::Arguments>) {
let mut stderr = OStream::new();
- stderr.set_state(CharState::from_colors(
- Color::LightRed,
- Color::Red,
- ));
+ stderr.set_state(CharState::from_colors(Color::LightRed, Color::Red));
stderr.clear();
stderr.print(b"uff-os");
stderr.set_row(10);
- stderr.set_state(CharState::from_colors(
- Color::White,
- Color::Red,
- ));
+ stderr.set_state(CharState::from_colors(Color::White, Color::Red));
stderr.print_centered(b"<kernel panic>");
stderr.set_row(14);
- stderr.set_state(CharState::from_colors(
- Color::Cyan,
- Color::Red,
- ));
+ stderr.set_state(CharState::from_colors(Color::Cyan, Color::Red));
stderr.set_centered(true);
let buffer: &mut [u8] = &mut [b' '; PANIC_SCREEN_MESSAGE_BUFFER_SIZE];
let mut tbuffer = TextBuffer::new(buffer);
- let _ = core::fmt::write(&mut tbuffer, *args.unwrap_or(&format_args!("no panic information obtainable")));
+ let _ = core::fmt::write(
+ &mut tbuffer,
+ *args.unwrap_or(&format_args!("no panic information obtainable")),
+ );
stderr.print(tbuffer.get());
stderr.set_centered(false);
}