Skip to content

Commit 0bb03ce

Browse files
authored
Merge pull request #78 from allisonkarlitskaya/send
imageproxy: make ImageProxy: Send + Sync
2 parents 8327958 + 560d344 commit 0bb03ce

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

src/imageproxy.rs

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,10 @@ struct Reply {
132132
}
133133

134134
type ChildFuture = Pin<
135-
Box<dyn Future<Output = std::result::Result<std::io::Result<std::process::Output>, JoinError>>>,
135+
Box<
136+
dyn Future<Output = std::result::Result<std::io::Result<std::process::Output>, JoinError>>
137+
+ Send,
138+
>,
136139
>;
137140

138141
/// Manage a child process proxy to fetch container images.
@@ -718,4 +721,20 @@ mod tests {
718721
Err(e) => panic!("Unexpected error {e}"),
719722
}
720723
}
724+
725+
#[tokio::test]
726+
async fn test_proxy_send_sync() {
727+
fn assert_send_sync(_x: impl Send + Sync) {}
728+
729+
let Ok(proxy) = ImageProxy::new().await else {
730+
// doesn't matter: we only actually care to test if this compiles
731+
return;
732+
};
733+
assert_send_sync(&proxy);
734+
assert_send_sync(proxy);
735+
736+
let opened = OpenedImage(0);
737+
assert_send_sync(&opened);
738+
assert_send_sync(opened);
739+
}
721740
}

0 commit comments

Comments
 (0)