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

More tidying up of `aws-smithy-runtime-api` (#2869)

This PR finishes documenting `aws-smithy-runtime-api` and also:

- Adds `Send + Sync` bounds to `Interceptor`.
- Moves `Interceptors` into `aws-smithy-runtime`.
- Expands the more complicated macros in the interceptor context
wrappers.
- Makes the `OrchestratorError` an informative error according to
[RFC-22](https://github.com/awslabs/smithy-rs/blob/main/design/src/rfcs/rfc0022_error_context_and_compatibility.md).
- Renames `ConnectorError::is_other` to `as_other` and adds an
equivalent `is_other` that returns a boolean.

----

_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
parent a5465b79
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -77,7 +77,7 @@ impl<AP> RequestChecksumInterceptor<AP> {

impl<AP> Interceptor for RequestChecksumInterceptor<AP>
where
    AP: Fn(&Input) -> Result<Option<ChecksumAlgorithm>, BoxError>,
    AP: Fn(&Input) -> Result<Option<ChecksumAlgorithm>, BoxError> + Send + Sync,
{
    fn read_before_serialization(
        &self,
+1 −1
Original line number Diff line number Diff line
@@ -54,7 +54,7 @@ impl<VE> ResponseChecksumInterceptor<VE> {

impl<VE> Interceptor for ResponseChecksumInterceptor<VE>
where
    VE: Fn(&Input) -> bool,
    VE: Fn(&Input) -> bool + Send + Sync,
{
    fn read_before_serialization(
        &self,
+1 −1
Original line number Diff line number Diff line
@@ -69,7 +69,7 @@ where

impl<G, T> Interceptor for Route53ResourceIdInterceptor<G, T>
where
    G: for<'a> Fn(&'a mut T) -> &'a mut Option<String>,
    G: for<'a> Fn(&'a mut T) -> &'a mut Option<String> + Send + Sync,
    T: fmt::Debug + Send + Sync + 'static,
{
    fn modify_before_serialization(
+1 −1
Original line number Diff line number Diff line
@@ -91,7 +91,7 @@ class InterceptorConfigCustomization(codegenContext: ClientCodegenContext) : Con
                        /// ## }
                        /// ## }
                        /// ```
                        pub fn interceptor(mut self, interceptor: impl #{Interceptor} + Send + Sync + 'static) -> Self {
                        pub fn interceptor(mut self, interceptor: impl #{Interceptor} + 'static) -> Self {
                            self.push_interceptor(#{SharedInterceptor}::new(interceptor));
                            self
                        }
+1 −1
Original line number Diff line number Diff line
@@ -199,7 +199,7 @@ class CustomizableOperationGenerator(
                        /// `map_request`, and `mutate_request` (the last two are implemented via interceptors under the hood).
                        /// The order in which those user-specified operation interceptors are invoked should not be relied upon
                        /// as it is an implementation detail.
                        pub fn interceptor(mut self, interceptor: impl #{Interceptor} + #{Send} + #{Sync} + 'static) -> Self {
                        pub fn interceptor(mut self, interceptor: impl #{Interceptor} + 'static) -> Self {
                            self.interceptors.push(#{SharedInterceptor}::new(interceptor));
                            self
                        }
Loading