Implement printf (very simple version)

This commit is contained in:
Jeremy Soller
2018-03-03 19:47:01 -07:00
parent bf987098dc
commit 5520526bef
11 changed files with 176 additions and 19 deletions
+19
View File
@@ -17,3 +17,22 @@ mod sys;
mod sys;
pub mod types;
use core::fmt;
use types::c_int;
pub struct FileWriter(pub c_int);
impl FileWriter {
pub fn write(&mut self, buf: &[u8]) {
write(self.0, buf);
}
}
impl fmt::Write for FileWriter {
fn write_str(&mut self, s: &str) -> fmt::Result {
self.write(s.as_bytes());
Ok(())
}
}