Function init_loop
Source pub fn init_loop(sleep_duration: u64) -> Result<(State, Process)>
5fn main() -> eyre::Result<()> {
6 let (mut state, process) = init_loop(500)?;
7 println!("Successfully initialized!");
8 loop {
9 match get_ig_time(&process, &mut state) {
10 Ok(ig_time) => println!("Current ig time: {ig_time:?}"),
11 Err(e) => println!("Error: {e:?}"),
12 }
13 std::thread::sleep(std::time::Duration::from_millis(1000));
14 }
15}
More examples
Hide additional examples
5fn main() -> eyre::Result<()> {
6 let (mut state, process) = init_loop(500)?;
7 println!("Successfully initialized!");
8 loop {
9 match get_beatmap_info(&process, &mut state) {
10 Ok(beatmap_info) => println!("Current beatmap info: {beatmap_info:?}"),
11 Err(e) => println!("Error: {e:?}"),
12 }
13 std::thread::sleep(std::time::Duration::from_millis(1000));
14 }
15}
7fn main() -> eyre::Result<()> {
8 let (mut state, process) = init_loop(500)?;
9 let mut beatmap_reader = BeatmapReader::new(&process, &mut state, OsuType::Stable)?;
10 loop {
11 match beatmap_reader.get_beatmap_info() {
12 Ok(beatmap_info) => println!("Current beatmap info: {beatmap_info:?}"),
13 Err(e) => println!("Error: {e:?}"),
14 }
15 std::thread::sleep(std::time::Duration::from_millis(1000));
16 }
17}
116fn main() -> Result<()> {
117 let (mut state, process) = init_loop(500)?;
119 println!("Successfully connected to osu! process!");
120
121 let mut calc_state = CalculatorState::new();
123
124 loop {
126 if let Err(e) = process_game_state(&process, &mut state, &mut calc_state) {
127 eprintln!("Error during processing: {e}");
128 }
129
130 std::thread::sleep(Duration::from_millis(1000));
132 }
133}