Created
February 25, 2017 15:24
-
-
Save iwillspeak/a3146ae87b6a5d26d6d06d8c73614e0d to your computer and use it in GitHub Desktop.
Yop Yop Yop
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
[package] | |
name = "yop" | |
version = "0.1.0" | |
authors = ["Will Speak <lithiumflame@gmail.com>"] | |
[dependencies] | |
[[bin]] | |
name = "yop" | |
path = "yop.rs" |
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
use std::{thread, time, io}; | |
use std::io::prelude::*; | |
const CHOICES: [char;4] = [ | |
'⠸', | |
'⠪', | |
'⠇', | |
'⠕', | |
]; | |
fn main() { | |
let delay = time::Duration::from_millis(500); | |
let mut choice = 0; | |
while true { | |
print!(" {}\r", CHOICES[choice]); | |
io::stdout().flush().unwrap(); | |
thread::sleep(delay); | |
choice = (choice + 1) % 4; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment