feat: add some more functions to input
This commit is contained in:
parent
197248260b
commit
979a6c5979
2 changed files with 8 additions and 2 deletions
|
|
@ -1,4 +1,10 @@
|
|||
use std::io::Read;
|
||||
|
||||
// this function makes it so that an EOF (commonly used in pipes) stops the repl
|
||||
pub fn get_like_repl(buffer: &mut String) -> bool {
|
||||
pub fn repl(buffer: &mut String) -> bool {
|
||||
std::io::stdin().read_line(buffer).unwrap_or(0) > 0
|
||||
}
|
||||
|
||||
pub fn repl_with_file(file: &mut Box<dyn Read>, buffer: &mut String) -> bool {
|
||||
file.read_to_string(buffer).unwrap_or(0) > 0
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue