libobs_wrapper\bootstrap/
status_handler.rs1use std::fmt::Debug;
2
3#[cfg_attr(not(feature="blocking"), async_trait::async_trait)]
5pub trait ObsBootstrapStatusHandler : Debug + Send + Sync {
6 #[cfg_attr(feature="blocking", remove_async_await::remove_async_await)]
7 async fn handle_downloading(&mut self, progress: f32, message: String) -> anyhow::Result<()>;
8 #[cfg_attr(feature="blocking", remove_async_await::remove_async_await)]
9 async fn handle_extraction(&mut self, progress: f32, message: String) -> anyhow::Result<()>;
10}
11
12
13#[derive(Debug)]
14pub struct ObsBootstrapConsoleHandler;
15
16impl Default for ObsBootstrapConsoleHandler {
17 fn default() -> Self {
18 Self
19 }
20}
21
22#[cfg_attr(not(feature="blocking"), async_trait::async_trait)]
23impl ObsBootstrapStatusHandler for ObsBootstrapConsoleHandler {
24 #[cfg_attr(feature="blocking", remove_async_await::remove_async_await)]
25 async fn handle_downloading(&mut self, progress: f32, message: String) -> anyhow::Result<()> {
26 println!("Downloading: {}% - {}", progress * 100.0, message);
27 Ok(())
28 }
29
30 #[cfg_attr(feature="blocking", remove_async_await::remove_async_await)]
31 async fn handle_extraction(&mut self, progress: f32, message: String) -> anyhow::Result<()> {
32 println!("Extracting: {}% - {}", progress * 100.0, message);
33 Ok(())
34 }
35}