Unverified Commit 3f108165 authored by Zelda Hessler's avatar Zelda Hessler Committed by GitHub
Browse files

Update: swap pin-project for pin-project-lite (#1503)



* update: swap pin-project for pin-project-lite
* remove: pin attribute from `aws_smithy_http::body::Inner::Once` enum variant
* remove: unnecessary usage of pin-project
* Update CHANGELOG.next.toml

Co-authored-by: default avatarJohn DiSanti <jdisanti@amazon.com>
parent 23ca3956
Loading
Loading
Loading
Loading
+26 −0
Original line number Diff line number Diff line
@@ -22,6 +22,32 @@ references = ["aws-sdk-rust#560", "smithy-rs#1487"]
meta = { "breaking" = false, "tada" = false, "bug" = true }
author = "rcoh"

[[smithy-rs]]
message = """
Replaced use of `pin-project` with equivalent `pin-project-lite`. For pinned enum tuple variants and tuple structs, this
change requires that we switch to using enum struct variants and regular structs. Most of the structs and enums that
were updated had only private fields/variants and so have the same public API. However, this change does affect the
public API of `aws_smithy_http_tower::map_request::MapRequestFuture<F, E>`. The `Inner` and `Ready` variants contained a
single value. Each have been converted to struct variants and the inner value is now accessible by the `inner` field
instead of the `0` field.
"""
references = ["smithy-rs#932"]
meta = { "breaking" = true, "tada" = false, "bug" = false }
author = "Velfi"

[[aws-sdk-rust]]
message = """
Replaced use of `pin-project` with equivalent `pin-project-lite`. For pinned enum tuple variants and tuple structs, this
change requires that we switch to using enum struct variants and regular structs. Most of the structs and enums that
were updated had only private fields/variants and so have the same public API. However, this change does affect the
public API of `aws_smithy_http_tower::map_request::MapRequestFuture<F, E>`. The `Inner` and `Ready` variants contained a
single value. Each have been converted to struct variants and the inner value is now accessible by the `inner` field
instead of the `0` field.
"""
references = ["smithy-rs#932"]
meta = { "breaking" = true, "tada" = false, "bug" = false }
author = "Velfi"

[[aws-sdk-rust]]
message = "Add comments for docker settings needed when using this sdk"
references = ["aws-sdk-rust#540"]
+4 −9
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ client-hyper = ["hyper"]
aws-smithy-async = { path = "../aws-smithy-async" }
aws-smithy-http = { path = "../aws-smithy-http" }
aws-smithy-http-tower = { path = "../aws-smithy-http-tower" }
aws-smithy-protocol-test = { path = "../aws-smithy-protocol-test", optional = true }
aws-smithy-types = { path = "../aws-smithy-types" }
bytes = "1"
fastrand = "1.4.0"
@@ -28,23 +29,17 @@ hyper-rustls = { version = "0.22.1", optional = true, features = ["rustls-native
hyper-tls = { version = "0.5.0", optional = true }
lazy_static = { version = "1", optional = true }
pin-project-lite = "0.2.7"
# tokio but with no features enabled (traits only)
serde = { version = "1", features = ["derive"], optional = true }
tokio = { version = "1"}
tower = { version = "0.4.6", features = ["util", "retry"] }

pin-project = "1"
tracing = "0.1"

aws-smithy-protocol-test = { path = "../aws-smithy-protocol-test", optional = true }
serde = { version = "1", features = ["derive"], optional = true }

[dev-dependencies]
tokio = { version = "1", features = ["full", "test-util"] }
aws-smithy-async = { path = "../aws-smithy-async", features = ["rt-tokio"] }

tower-test = "0.4.0"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
tokio = { version = "1", features = ["full", "test-util"] }
tower-test = "0.4.0"
tracing-test = "0.2.1"

[package.metadata.docs.rs]
+1 −1
Original line number Diff line number Diff line
@@ -10,7 +10,7 @@ repository = "https://github.com/awslabs/smithy-rs"
[dependencies]
aws-smithy-http = { path = "../aws-smithy-http" }
tower = { version = "0.4.4" }
pin-project = "1"
pin-project-lite = "0.2.9"
http = "0.2.3"
bytes = "1"
http-body = "0.4.4"
+16 −9
Original line number Diff line number Diff line
@@ -6,7 +6,7 @@
use crate::SendOperationError;
use aws_smithy_http::middleware::{AsyncMapRequest, MapRequest};
use aws_smithy_http::operation;
use pin_project::pin_project;
use pin_project_lite::pin_project;
use std::future::Future;
use std::pin::Pin;
use std::task::{Context, Poll};
@@ -97,10 +97,15 @@ where
    }
}

#[pin_project(project = EnumProj)]
pin_project! {
    #[project = EnumProj]
    pub enum MapRequestFuture<F, E> {
    Inner(#[pin] F),
    Ready(Option<E>),
        Inner {
            #[pin]
            inner: F
        },
        Ready { inner: Option<E> },
    }
}

impl<O, F, E> Future for MapRequestFuture<F, E>
@@ -111,8 +116,8 @@ where

    fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
        match self.project() {
            EnumProj::Ready(e) => Poll::Ready(Err(e.take().unwrap())),
            EnumProj::Inner(f) => f.poll(cx),
            EnumProj::Inner { inner: f } => f.poll(cx),
            EnumProj::Ready { inner: e } => Poll::Ready(Err(e.take().unwrap())),
        }
    }
}
@@ -143,8 +148,10 @@ where
            .apply(req)
            .map_err(|e| SendOperationError::RequestConstructionError(e.into()))
        {
            Err(e) => MapRequestFuture::Ready(Some(e)),
            Ok(req) => MapRequestFuture::Inner(self.inner.call(req)),
            Err(e) => MapRequestFuture::Ready { inner: Some(e) },
            Ok(req) => MapRequestFuture::Inner {
                inner: self.inner.call(req),
            },
        }
    }
}
+1 −1
Original line number Diff line number Diff line
@@ -23,7 +23,7 @@ http = "0.2.3"
http-body = "0.4.4"
once_cell = "1.10"
percent-encoding = "2.1.0"
pin-project = "1"
pin-project-lite = "0.2.9"
tracing = "0.1"

# We are using hyper for our streaming body implementation, but this is an internal detail.
Loading