Skip to content

Commit

Permalink
tweak: add explicit Send bounds
Browse files Browse the repository at this point in the history
  • Loading branch information
passcod committed Apr 20, 2024
1 parent 651185d commit 45f5c24
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/generic_wrap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/tokio/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<dyn Future<Output = Result<()>> + '_> {
fn kill(&mut self) -> Box<dyn Future<Output = Result<()>> + Send + '_> {
Box::new(async {
self.start_kill()?;
Box::into_pin(self.wait()).await?;
Expand Down Expand Up @@ -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<dyn Future<Output = Result<ExitStatus>> + '_> {
fn wait(&mut self) -> Box<dyn Future<Output = Result<ExitStatus>> + Send + '_> {
Box::new(self.inner_mut().wait())
}

Expand All @@ -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<Self>) -> Box<dyn Future<Output = Result<Output>>>
fn wait_with_output(mut self: Box<Self>) -> Box<dyn Future<Output = Result<Output>> + Send>
where
Self: 'static,
{
Expand Down
2 changes: 1 addition & 1 deletion src/tokio/process_group.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ impl TokioChildWrapper for ProcessGroupChild {
}

#[instrument(level = "debug", skip(self))]
fn wait(&mut self) -> Box<dyn Future<Output = Result<ExitStatus>> + '_> {
fn wait(&mut self) -> Box<dyn Future<Output = Result<ExitStatus>> + Send + '_> {
Box::new(async {
if let ChildExitStatus::Exited(status) = &self.exit_status {
return Ok(*status);
Expand Down

0 comments on commit 45f5c24

Please sign in to comment.