Skip to content

Commit

Permalink
Fix lack of the Sync auto trait on event stream outputs (#2496)
Browse files Browse the repository at this point in the history
  • Loading branch information
jdisanti authored Mar 24, 2023
1 parent 3f738ca commit db76db9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
14 changes: 13 additions & 1 deletion CHANGELOG.next.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,16 @@
# message = "Fix typos in module documentation for generated crates"
# references = ["smithy-rs#920"]
# meta = { "breaking" = false, "tada" = false, "bug" = false, "target" = "client | server | all"}
# author = "rcoh"
# author = "rcoh"

[[aws-sdk-rust]]
message = "The outputs for event stream operations (for example, S3's SelectObjectContent) now implement the `Sync` auto-trait."
references = ["smithy-rs#2496"]
meta = { "breaking" = false, "tada" = false, "bug" = true }
author = "jdisanti"

[[smithy-rs]]
message = "The outputs for event stream operations now implement the `Sync` auto-trait."
references = ["smithy-rs#2496"]
meta = { "breaking" = false, "tada" = false, "bug" = true, "target" = "all"}
author = "jdisanti"
10 changes: 5 additions & 5 deletions rust-runtime/aws-smithy-http/src/event_stream/receiver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ impl StdError for ReceiverError {}
/// Receives Smithy-modeled messages out of an Event Stream.
#[derive(Debug)]
pub struct Receiver<T, E> {
unmarshaller: Box<dyn UnmarshallMessage<Output = T, Error = E> + Send>,
unmarshaller: Box<dyn UnmarshallMessage<Output = T, Error = E> + Send + Sync>,
decoder: MessageFrameDecoder,
buffer: RecvBuf,
body: SdkBody,
Expand All @@ -143,7 +143,7 @@ pub struct Receiver<T, E> {
impl<T, E> Receiver<T, E> {
/// Creates a new `Receiver` with the given message unmarshaller and SDK body.
pub fn new(
unmarshaller: impl UnmarshallMessage<Output = T, Error = E> + Send + 'static,
unmarshaller: impl UnmarshallMessage<Output = T, Error = E> + Send + Sync + 'static,
body: SdkBody,
) -> Self {
Receiver {
Expand Down Expand Up @@ -548,10 +548,10 @@ mod tests {
);
}

fn assert_send<T: Send>() {}
fn assert_send_and_sync<T: Send + Sync>() {}

#[tokio::test]
async fn receiver_is_send() {
assert_send::<Receiver<(), ()>>();
async fn receiver_is_send_and_sync() {
assert_send_and_sync::<Receiver<(), ()>>();
}
}

0 comments on commit db76db9

Please sign in to comment.