From 45f5c2465b6e16ac1999f19098366cde272d3422 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fe=CC=81lix=20Saparelli?= Date: Sat, 20 Apr 2024 15:18:48 +1200 Subject: [PATCH] tweak: add explicit Send bounds --- src/generic_wrap.rs | 2 +- src/tokio/core.rs | 6 +++--- src/tokio/process_group.rs | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/generic_wrap.rs b/src/generic_wrap.rs index 00551d3..547aaeb 100644 --- a/src/generic_wrap.rs +++ b/src/generic_wrap.rs @@ -167,7 +167,7 @@ macro_rules! Wrap { /// #[derive(Debug)] /// pub struct YourWrapper; #[doc = concat!("impl ", stringify!($wrapper), " for YourWrapper {}\n```")] - pub trait $wrapper: ::std::fmt::Debug { + pub trait $wrapper: ::std::fmt::Debug + Send + Sync { /// Called on a first instance if a second of the same type is added. /// /// Only one of a wrapper type can exist within a Wrap at a time. The default behaviour diff --git a/src/tokio/core.rs b/src/tokio/core.rs index 8ed3311..9a46499 100644 --- a/src/tokio/core.rs +++ b/src/tokio/core.rs @@ -109,7 +109,7 @@ pub trait TokioChildWrapper: std::fmt::Debug + Send + Sync { /// By default this calls `start_kill()` and then `wait()`, which is the same way it is done on /// the underlying `Child`, but that way implementing either or both of those methods will use /// them when calling `kill()`, instead of requiring a stub implementation. - fn kill(&mut self) -> Box> + '_> { + fn kill(&mut self) -> Box> + Send + '_> { Box::new(async { self.start_kill()?; Box::into_pin(self.wait()).await?; @@ -142,7 +142,7 @@ pub trait TokioChildWrapper: std::fmt::Debug + Send + Sync { /// has exited will always return the same result. /// /// By default this is a passthrough to the underlying `Child`. - fn wait(&mut self) -> Box> + '_> { + fn wait(&mut self) -> Box> + Send + '_> { Box::new(self.inner_mut().wait()) } @@ -152,7 +152,7 @@ pub trait TokioChildWrapper: std::fmt::Debug + Send + Sync { /// /// By default this is a reimplementation of the Tokio method, so that it can use the wrapper's /// `wait()` method instead of the underlying `Child`'s `wait()`. - fn wait_with_output(mut self: Box) -> Box>> + fn wait_with_output(mut self: Box) -> Box> + Send> where Self: 'static, { diff --git a/src/tokio/process_group.rs b/src/tokio/process_group.rs index deb29ae..de7bc04 100644 --- a/src/tokio/process_group.rs +++ b/src/tokio/process_group.rs @@ -191,7 +191,7 @@ impl TokioChildWrapper for ProcessGroupChild { } #[instrument(level = "debug", skip(self))] - fn wait(&mut self) -> Box> + '_> { + fn wait(&mut self) -> Box> + Send + '_> { Box::new(async { if let ChildExitStatus::Exited(status) = &self.exit_status { return Ok(*status);