Last active
December 26, 2015 05:09
-
-
Save cnd/7098985 to your computer and use it in GitHub Desktop.
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::task; | |
use std::rt::io::timer::sleep; | |
///<Summary> | |
///Simple butterfly | |
///</Summary> | |
pub fn butterfly<U>(f: &fn() -> U) -> U { | |
let (port, chan) = stream(); | |
do task::spawn_sched(task::SingleThreaded) { | |
print(" "); | |
while !port.peek() { | |
let bug3911 = ["|","/","-","\\"]; | |
for fly in bug3911.iter() { | |
print!("\x08{:s}", *fly); | |
sleep(100); | |
}; | |
} | |
} | |
let ret = f(); | |
chan.send(()); | |
ret | |
} | |
do butterfly { | |
io::stdin().read_line(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment