someone broke a mod.rs so i fixed it.
This commit is contained in:
+3
-1
@@ -38,7 +38,9 @@ pub mod prelude {
|
|||||||
pub use crate::{
|
pub use crate::{
|
||||||
eprint, eprintln, print, print_log, println, println_log, serial_print,
|
eprint, eprintln, print, print_log, println, println_log, serial_print,
|
||||||
serial_println,
|
serial_println,
|
||||||
std::io::{_print, _print_err, _print_log, _serial_write},
|
debug, debugln,
|
||||||
|
std::io::{_print, _print_log, _serial_write, _print_err},
|
||||||
|
std::debug::_debug,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,82 +0,0 @@
|
|||||||
pub use crate::arch::x86_64::drivers::{
|
|
||||||
ascii::{_print, _print_err, _print_log},
|
|
||||||
serial::_serial_write,
|
|
||||||
};
|
|
||||||
pub mod stdin {
|
|
||||||
use crate::arch::x86_64::drivers::{
|
|
||||||
ascii::WRITER,
|
|
||||||
keyboard::{
|
|
||||||
get_keystroke_async, get_keystroke_optional, KeyStroke,
|
|
||||||
}
|
|
||||||
};
|
|
||||||
use alloc::string::String;
|
|
||||||
|
|
||||||
/// Reads a line of input from standard input asynchronously, returning a `String` containing
|
|
||||||
/// the input line. Does not include the newline character at the end of the line.
|
|
||||||
///
|
|
||||||
/// If the user presses the abort key (usually Ctrl+C), the returned string will be empty.
|
|
||||||
///
|
|
||||||
/// This function is currently unimplemented.
|
|
||||||
pub async fn read_line() -> String {
|
|
||||||
let mut writer = WRITER.lock();
|
|
||||||
|
|
||||||
let mut buff = String::new();
|
|
||||||
loop {
|
|
||||||
match get_keystroke_async().await {
|
|
||||||
KeyStroke::Char(c) => match c {
|
|
||||||
'\n' => {
|
|
||||||
writer.write_glyph(c as u8);
|
|
||||||
return buff;
|
|
||||||
}
|
|
||||||
'\r' => {
|
|
||||||
writer.write_glyph(c as u8);
|
|
||||||
return buff;
|
|
||||||
}
|
|
||||||
'\x08' => {
|
|
||||||
if !buff.is_empty() {
|
|
||||||
buff.pop();
|
|
||||||
writer.backspace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
c => {
|
|
||||||
writer.write_glyph(c as u8);
|
|
||||||
buff.push(c)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
KeyStroke::Enter => {
|
|
||||||
writer.write_glyph(b'\n');
|
|
||||||
return buff;
|
|
||||||
}
|
|
||||||
KeyStroke::Backspace => {
|
|
||||||
if !buff.is_empty() {
|
|
||||||
buff.pop();
|
|
||||||
writer.backspace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_ => continue,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Reads a character from standard input and blocks the current task until a character is
|
|
||||||
/// available.
|
|
||||||
///
|
|
||||||
/// # Note
|
|
||||||
///
|
|
||||||
/// This function is not yet implemented.
|
|
||||||
pub async fn async_keystroke() -> KeyStroke {
|
|
||||||
get_keystroke_async().await
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Attempt to read a character from standard input without blocking the current task.
|
|
||||||
///
|
|
||||||
/// If no character is available, returns `None`.
|
|
||||||
///
|
|
||||||
/// # Note
|
|
||||||
///
|
|
||||||
/// This function is not yet implemented.
|
|
||||||
pub fn keystroke() -> Option<KeyStroke> {
|
|
||||||
get_keystroke_optional()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user