Last active
March 29, 2023 13:22
-
-
Save Whimfoome/ce56c6b6743f4a8683ae4daf22fb549b to your computer and use it in GitHub Desktop.
Rust Helpers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn print(buffer: &str) { | |
use std::io::Write; | |
print!("{}", buffer); | |
std::io::stdout().flush().unwrap(); | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn read_input() -> String { | |
let mut user_input = String::new(); | |
match std::io::stdin().read_line(&mut user_input) { | |
Ok(_) => (), | |
Err(_) => panic!("Couldn't read line"), | |
}; | |
return user_input.trim().to_owned(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment