Skip to content

Instantly share code, notes, and snippets.

@Whimfoome
Last active March 29, 2023 13:22
Show Gist options
  • Save Whimfoome/ce56c6b6743f4a8683ae4daf22fb549b to your computer and use it in GitHub Desktop.
Save Whimfoome/ce56c6b6743f4a8683ae4daf22fb549b to your computer and use it in GitHub Desktop.
Rust Helpers
fn print(buffer: &str) {
use std::io::Write;
print!("{}", buffer);
std::io::stdout().flush().unwrap();
}
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