From 341f7fbc4b4d29b70b5aa1f80b45e493c84c0b28 Mon Sep 17 00:00:00 2001 From: One <43485962+c-git@users.noreply.github.com> Date: Sat, 4 Jan 2025 23:08:13 -0500 Subject: [PATCH] feat: remove send bounds in WASM for all traits --- src/traits.rs | 9 --------- src/traits/native.rs | 9 +++++++++ src/traits/wasm.rs | 8 ++++++++ 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/traits.rs b/src/traits.rs index b0ec0ef..1ed74a1 100644 --- a/src/traits.rs +++ b/src/traits.rs @@ -18,12 +18,3 @@ mod wasm; pub use native::*; #[cfg(target_arch = "wasm32")] pub use wasm::*; - -/// A function able to be used as a Call Back to notify the UI that the request -/// is ready -pub trait UiCallBack: 'static + Send + FnOnce() {} -impl UiCallBack for T where T: 'static + Send + FnOnce() {} - -/// Allowed return types -pub trait ValidReturn: Send + 'static {} -impl ValidReturn for T {} diff --git a/src/traits/native.rs b/src/traits/native.rs index ea85483..29fcaad 100644 --- a/src/traits/native.rs +++ b/src/traits/native.rs @@ -31,3 +31,12 @@ impl> DoneHandler for T where /// A future with the required bounds for the platform pub trait BoundedFuture: Future + Send {} impl BoundedFuture for T where T: Future + Send {} + +/// A function able to be used as a Call Back to notify the UI that the request +/// is ready +pub trait UiCallBack: 'static + Send + FnOnce() {} +impl UiCallBack for T where T: 'static + Send + FnOnce() {} + +/// Allowed return types +pub trait ValidReturn: Send + 'static {} +impl ValidReturn for T {} diff --git a/src/traits/wasm.rs b/src/traits/wasm.rs index 684304e..63023eb 100644 --- a/src/traits/wasm.rs +++ b/src/traits/wasm.rs @@ -28,3 +28,11 @@ impl> DoneHandler for T where T: 'static + FnOnce(reqwest::Result) -> O { } + +/// dox +pub trait UiCallBack: 'static + FnOnce() {} +impl UiCallBack for T where T: 'static + FnOnce() {} + +/// dox +pub trait ValidReturn: 'static {} +impl ValidReturn for T {}