From ebce1449d65ee438e4284af70087a1b5255b7276 Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Sun, 19 Nov 2023 07:16:13 -0600 Subject: [PATCH] trying to find a way for a central tokio::runtime --- src/rust/utils.rs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/rust/utils.rs b/src/rust/utils.rs index c34163e..84d9a1c 100644 --- a/src/rust/utils.rs +++ b/src/rust/utils.rs @@ -47,10 +47,21 @@ mod db { #[cxx_qt::bridge] mod utilities { + use tokio::runtime::Runtime; #[cxx_qt::qobject] - #[derive(Default, Debug)] - pub struct Utils {} + #[derive(Debug)] + pub struct Utils { + runtime: Runtime, + } + + impl Default for Utils { + fn default() -> Self { + Self { + runtime: tokio::runtime::Runtime::new().unwrap(), + } + } + } impl qobject::Utils { #[qinvokable]