Commit d212f8dd authored by AWS SDK Rust Bot's avatar AWS SDK Rust Bot
Browse files

[smithy-rs] Rollup of 8 commits



Includes commits:
  7fb78bb6 Add lifetimes in structure impl (#3106)
  a5f1653c Allow custom writables in Instantiator (#3104)
  7768e03e Upgrade semver checks to 0.24.1 (#3102)
  5a8b07c6 Small tweaks to the HTTP wrapper (#3099)
  06e265df Update SDK external types (#3080)
  53dcff3f Build services with a derived configuration object (#3095)
  22de9706 Update publisher (#3110)
  b6841826 Enable the tokio-rt feature for generated crates when bytestream is used (#3113)

Co-authored-by: default avatar82marbag <69267416+82marbag@users.noreply.github.com>
Co-authored-by: default avatarRussell Cohen <rcoh@amazon.com>
Co-authored-by: default avatardavid-perez <d@vidp.dev>
parent 0ff4059b
Loading
Loading
Loading
Loading
+28 −3
Original line number Diff line number Diff line
@@ -380,7 +380,7 @@ impl Headers {
        key: impl AsHeaderComponent,
        value: impl AsHeaderComponent,
    ) -> Result<Option<String>, HttpError> {
        let key = header_name(key.into_maybe_static()?)?;
        let key = header_name(key)?;
        let value = header_value(value.into_maybe_static()?)?;
        Ok(self
            .headers
@@ -404,8 +404,10 @@ impl Headers {
    /// Removes all headers with a given key
    ///
    /// If there are multiple entries for this key, the first entry is returned
    pub fn remove(&mut self, key: &str) -> Option<HeaderValue> {
        self.headers.remove(key)
    pub fn remove(&mut self, key: impl AsRef<str>) -> Option<String> {
        self.headers
            .remove(key.as_ref())
            .map(|h| h.as_str().to_string())
    }

    /// Appends a value to a given key
@@ -427,6 +429,9 @@ mod sealed {
        /// If the component can be represented as a Cow<'static, str>, return it
        fn into_maybe_static(self) -> Result<MaybeStatic, HttpError>;

        /// Return a string reference to this header
        fn as_str(&self) -> Result<&str, HttpError>;

        /// If a component is already internally represented as a `http02x::HeaderName`, return it
        fn repr_as_http02x_header_name(self) -> Result<http0::HeaderName, Self>
        where
@@ -440,18 +445,30 @@ mod sealed {
        fn into_maybe_static(self) -> Result<MaybeStatic, HttpError> {
            Ok(Cow::Borrowed(self))
        }

        fn as_str(&self) -> Result<&str, HttpError> {
            Ok(self)
        }
    }

    impl AsHeaderComponent for String {
        fn into_maybe_static(self) -> Result<MaybeStatic, HttpError> {
            Ok(Cow::Owned(self))
        }

        fn as_str(&self) -> Result<&str, HttpError> {
            Ok(self)
        }
    }

    impl AsHeaderComponent for Cow<'static, str> {
        fn into_maybe_static(self) -> Result<MaybeStatic, HttpError> {
            Ok(self)
        }

        fn as_str(&self) -> Result<&str, HttpError> {
            Ok(self.as_ref())
        }
    }

    impl AsHeaderComponent for http0::HeaderValue {
@@ -462,6 +479,10 @@ mod sealed {
                    .to_string(),
            ))
        }

        fn as_str(&self) -> Result<&str, HttpError> {
            std::str::from_utf8(self.as_bytes()).map_err(HttpError::header_was_not_a_string)
        }
    }

    impl AsHeaderComponent for http0::HeaderName {
@@ -469,6 +490,10 @@ mod sealed {
            Ok(self.to_string().into())
        }

        fn as_str(&self) -> Result<&str, HttpError> {
            Ok(self.as_ref())
        }

        fn repr_as_http02x_header_name(self) -> Result<http0::HeaderName, Self>
        where
            Self: Sized,
+1 −1
Original line number Diff line number Diff line
@@ -132,7 +132,7 @@ fn apply_endpoint(
    for (header_name, header_values) in endpoint.headers() {
        request.headers_mut().remove(header_name);
        for value in header_values {
            request.headers_mut().insert(
            request.headers_mut().append(
                HeaderName::from_str(header_name).map_err(|err| {
                    ResolveEndpointError::message("invalid header name")
                        .with_source(Some(err.into()))
+1 −1
Original line number Diff line number Diff line
@@ -85,6 +85,6 @@ features = ["macros", "test-util", "rt-multi-thread"]

[features]
rustls = ["aws-smithy-runtime/tls-rustls"]
rt-tokio = ["aws-smithy-async/rt-tokio", "aws-smithy-types/rt-tokio"]
test-util = ["aws-credential-types/test-util", "aws-smithy-runtime/test-util"]
rt-tokio = ["aws-smithy-async/rt-tokio", "aws-smithy-types/rt-tokio"]
default = ["rustls", "rt-tokio"]
+1 −1
Original line number Diff line number Diff line
@@ -81,6 +81,6 @@ features = ["macros", "test-util", "rt-multi-thread"]

[features]
rustls = ["aws-smithy-runtime/tls-rustls"]
rt-tokio = ["aws-smithy-async/rt-tokio", "aws-smithy-types/rt-tokio"]
test-util = ["aws-credential-types/test-util", "aws-smithy-runtime/test-util"]
rt-tokio = ["aws-smithy-async/rt-tokio", "aws-smithy-types/rt-tokio"]
default = ["rustls", "rt-tokio"]
+1 −1
Original line number Diff line number Diff line
@@ -81,6 +81,6 @@ features = ["macros", "test-util", "rt-multi-thread"]

[features]
rustls = ["aws-smithy-runtime/tls-rustls"]
rt-tokio = ["aws-smithy-async/rt-tokio", "aws-smithy-types/rt-tokio"]
test-util = ["aws-credential-types/test-util", "aws-smithy-runtime/test-util"]
rt-tokio = ["aws-smithy-async/rt-tokio", "aws-smithy-types/rt-tokio"]
default = ["rustls", "rt-tokio"]
Loading