Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions crates/archive-trait/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ enum FilePayloadInner<'a> {
/// state to communicate that the payload has been consumed.
Buffered(Option<&'a [u8]>),
Reader {
source: Pin<Box<dyn AsyncRead + 'a>>,
source: Pin<Box<dyn AsyncRead + Send + 'a>>,
filesystem_path: Option<&'a Path>,
buffer: Vec<u8>,
remaining: u64,
Expand All @@ -181,7 +181,7 @@ impl<'a> FilePayload<'a> {
/// fail.
pub fn new<R>(size: u64, source: R) -> Self
where
R: AsyncRead + 'a,
R: AsyncRead + Send + 'a,
{
Self::streaming(size, source, Vec::new(), None)
}
Expand Down Expand Up @@ -219,7 +219,7 @@ impl<'a> FilePayload<'a> {
filesystem_path: Option<&'a Path>,
) -> Self
where
R: AsyncRead + 'a,
R: AsyncRead + Send + 'a,
{
Self {
size,
Expand Down
2 changes: 1 addition & 1 deletion crates/archive-trait/tests/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ async fn manual_entries_preserve_order_metadata_options_and_collision_state() {
.await
.expect("first entry should be added");
let mut readme_source = b"hello trailing".as_slice();
let readme_reader: &mut (dyn AsyncRead + Unpin) = &mut readme_source;
let readme_reader: &mut (dyn AsyncRead + Send + Unpin) = &mut readme_source;
builder
.add_file(
"README",
Expand Down
9 changes: 9 additions & 0 deletions crates/tar-codec/tests/encode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,15 @@ async fn encoded_paths(bytes: &[u8]) -> Vec<String> {
paths
}

#[test]
fn encoding_futures_are_send() {
fn assert_send(_: impl Send) {}

let mut encoder = TarEncoder::new(Vec::new()).builder();
assert_send(encoder.add_file("README", b"hello".as_slice(), EntryMetadata::default()));
assert_send(encoder.add_directory_all("tree"));
}

#[tokio::test]
async fn finishing_into_inner_returns_a_terminated_owned_archive() {
let mut encoder = TarEncoder::new(Vec::new()).builder();
Expand Down
Loading