forked from AbleOS/ableos
35 lines
636 B
Rust
35 lines
636 B
Rust
|
use core::fmt::Arguments;
|
||
|
use core::fmt::Error;
|
||
|
use core::fmt::Write;
|
||
|
|
||
|
use crate::kprintln;
|
||
|
|
||
|
#[derive(Debug, Clone, Copy)]
|
||
|
pub enum Device {
|
||
|
VTerm,
|
||
|
Serial,
|
||
|
}
|
||
|
#[derive(Debug, Clone, Copy)]
|
||
|
pub struct StdIO {
|
||
|
device: Device,
|
||
|
}
|
||
|
|
||
|
impl StdIO {
|
||
|
pub fn new(device: Device) -> StdIO {
|
||
|
StdIO { device }
|
||
|
}
|
||
|
pub fn write(&mut self) {
|
||
|
match self.device {
|
||
|
Device::VTerm => {
|
||
|
println!("Hello, world!");
|
||
|
}
|
||
|
Device::Serial => {
|
||
|
serial_println!("Hello, world!");
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
pub fn read(&mut self) {
|
||
|
todo!();
|
||
|
}
|
||
|
}
|