Unverified Commit db76db93 authored by John DiSanti's avatar John DiSanti Committed by GitHub
Browse files

Fix lack of the `Sync` auto trait on event stream outputs (#2496)

parent 3f738ca7
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
@@ -10,3 +10,15 @@
# references = ["smithy-rs#920"]
# meta = { "breaking" = false, "tada" = false, "bug" = false, "target" = "client | server | all"}
# 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"
+5 −5
Original line number Diff line number Diff line
@@ -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,
@@ -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 {
@@ -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<(), ()>>();
    }
}