mirror of
https://github.com/Drop-OSS/drop-app.git
synced 2025-11-15 01:01:25 +10:00
commit0f48f3fb44Author: quexeky <git@quexeky.dev> Date: Sun Oct 12 19:35:04 2025 +1100 chore: Run cargo clippy && cargo fmt Signed-off-by: quexeky <git@quexeky.dev> commit974666efe2Author: quexeky <git@quexeky.dev> Date: Sun Oct 12 19:17:40 2025 +1100 refactor: Finish refactor Signed-off-by: quexeky <git@quexeky.dev> commit9e1bf9852fAuthor: quexeky <git@quexeky.dev> Date: Sun Oct 12 18:33:43 2025 +1100 refactor: Builds, but some logic still left to move back Signed-off-by: quexeky <git@quexeky.dev> commit5d22b883d5Author: quexeky <git@quexeky.dev> Date: Sun Oct 12 17:04:27 2025 +1100 refactor: Improvements to src-tauri Signed-off-by: quexeky <git@quexeky.dev> commit62a2561539Author: quexeky <git@quexeky.dev> Date: Sat Oct 11 09:51:04 2025 +1100 fix: Remote tauri dependency from process Signed-off-by: quexeky <git@quexeky.dev> commit59f040bc8bAuthor: quexeky <git@quexeky.dev> Date: Thu Oct 9 07:46:17 2025 +1100 chore: Major refactoring Still needs a massive go-over because there shouldn't be anything referencing tauri in any of the workspaces except the original one. Process manager has been refactored as an example Signed-off-by: quexeky <git@quexeky.dev> Signed-off-by: quexeky <git@quexeky.dev>
42 lines
1.1 KiB
Rust
42 lines
1.1 KiB
Rust
#![feature(nonpoison_mutex)]
|
|
#![feature(sync_nonpoison)]
|
|
|
|
use std::{
|
|
ops::Deref,
|
|
sync::{OnceLock, nonpoison::Mutex},
|
|
};
|
|
|
|
use tauri::AppHandle;
|
|
|
|
use crate::process_manager::ProcessManager;
|
|
|
|
pub static PROCESS_MANAGER: ProcessManagerWrapper = ProcessManagerWrapper::new();
|
|
|
|
pub mod error;
|
|
pub mod format;
|
|
pub mod process_handlers;
|
|
pub mod process_manager;
|
|
|
|
pub struct ProcessManagerWrapper(OnceLock<Mutex<ProcessManager<'static>>>);
|
|
impl ProcessManagerWrapper {
|
|
const fn new() -> Self {
|
|
ProcessManagerWrapper(OnceLock::new())
|
|
}
|
|
pub fn init(app_handle: AppHandle) {
|
|
PROCESS_MANAGER
|
|
.0
|
|
.set(Mutex::new(ProcessManager::new(app_handle)))
|
|
.unwrap_or_else(|_| panic!("Failed to initialise Process Manager")); // Using panic! here because we can't implement Debug
|
|
}
|
|
}
|
|
impl Deref for ProcessManagerWrapper {
|
|
type Target = Mutex<ProcessManager<'static>>;
|
|
|
|
fn deref(&self) -> &Self::Target {
|
|
match self.0.get() {
|
|
Some(process_manager) => process_manager,
|
|
None => unreachable!("Download manager should always be initialised"),
|
|
}
|
|
}
|
|
}
|