1use rust_rocket::RocketPlayer;
2use std::error::Error;
3use std::fs::File;
4use std::time::Duration;
5
6static TRACKS_FILE: &str = "tracks.bin";
7
8fn main() -> Result<(), Box<dyn Error>> {
9 let rocket = {
10 let mut file = File::open(TRACKS_FILE)?;
12 let bincode_conf = bincode::config::standard();
14 let tracks = bincode::decode_from_std_read(&mut file, bincode_conf)?;
15 RocketPlayer::new(tracks)
17 };
18 println!("Tracks loaded from {}", TRACKS_FILE);
19
20 let mut current_row = 0;
21
22 loop {
23 println!(
24 "value: {:?} (row: {:?})",
25 rocket
26 .get_track("test")
27 .unwrap()
28 .get_value(current_row as f32),
29 current_row
30 );
31
32 current_row += 1;
33 std::thread::sleep(Duration::from_millis(32));
34 }
35}