use std::io;
use std::io::{Write};
use std::{thread, time};
fn main () {
let output = io::stdout();
let ten_millis = time::Duration::from_millis(1);
loop {
let mut handle = output.lock();
handle.write(b"|").unwrap();
thread::sleep(ten_millis);
handle.write(b"\x1b[1D").unwrap();
handle.write(b"/").unwrap();
thread::sleep(ten_millis);
handle.write(b"\x1b[1D").unwrap();
handle.write(b"-").unwrap();
thread::sleep(ten_millis);
handle.write(b"\x1b[1D").unwrap();
handle.write(b"\\").unwrap();
thread::sleep(ten_millis);
handle.write(b"\x1b[1D").unwrap();
}
}
Rustで制御コードでspinする
所要時間: 約 1分