From 270bc8b06b8fb8f7dcb35757a64fb4e0e2102c6d Mon Sep 17 00:00:00 2001 From: quexeky Date: Mon, 28 Oct 2024 22:04:50 +1100 Subject: [PATCH] Removed utils.rs --- src-tauri/src/utils.rs | 42 ------------------------------------------ 1 file changed, 42 deletions(-) delete mode 100644 src-tauri/src/utils.rs diff --git a/src-tauri/src/utils.rs b/src-tauri/src/utils.rs deleted file mode 100644 index fccc3f5..0000000 --- a/src-tauri/src/utils.rs +++ /dev/null @@ -1,42 +0,0 @@ - - -/* -// This function is designed to take in any function which does not regularly return a value, -// and instead loops over it until it returns "Complete". The current number of iterations -// is counted by "progress" -pub async fn progress_updater(function: Box ProgressChecker>, progress: AtomicUsize) { - loop { - if function() == ProgressChecker::Complete { break } - progress.fetch_add(1, Relaxed); - } -} - -pub async fn new_progress_updater(function: Box D>, contexts: T, progress: AtomicUsize) { - -} - -pub async fn threaded_progress_updater(f: F, progress: AtomicUsize, max_threads: usize, instances: usize) -> ProgressChecker -where F: Fn() -> ProgressChecker + Send + Clone + Copy + 'static -{ - let mut threads = Vec::new(); - let pool = ThreadPoolBuilder::new().num_threads(max_threads).build().unwrap(); - for instance in 0..instances { - pool.spawn(move || -> ProgressChecker { - let res = f(); - return res - }); - } - let mut completed = ProgressChecker::Incomplete; - for thread in threads { - if thread.await.unwrap() == Complete { - completed = Complete - } - progress.fetch_add(1, Ordering::Relaxed); - } - completed -} - -fn test() -> ProgressChecker { - ProgressChecker::Incomplete -} - */ \ No newline at end of file