From b2b9272bb7ef14ff0ff29e0a440dcf5bc4de7447 Mon Sep 17 00:00:00 2001 From: 82marbag <69267416+82marbag@users.noreply.github.com> Date: Tue, 25 Oct 2022 15:17:04 +0200 Subject: [PATCH] Type alias Signed-off-by: Daniele Ahmed --- .../src/operation/upgrade.rs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/rust-runtime/aws-smithy-http-server/src/operation/upgrade.rs b/rust-runtime/aws-smithy-http-server/src/operation/upgrade.rs index 0156da850d..ff12e55005 100644 --- a/rust-runtime/aws-smithy-http-server/src/operation/upgrade.rs +++ b/rust-runtime/aws-smithy-http-server/src/operation/upgrade.rs @@ -71,9 +71,6 @@ impl Layer for UpgradeLayer { } } -/// An alias allowing for quick access to [`UpgradeLayer`]s target [`Service`]. -pub type UpgradedService = as Layer>::Service; - /// A [`Service`] responsible for wrapping an operation [`Service`] accepting and returning Smithy /// types, and converting it into a [`Service`] accepting and returning [`http`] types. pub struct Upgrade { @@ -227,6 +224,10 @@ pub trait Upgradable { fn upgrade(self, plugin: &Plugin) -> Route; } +type UpgradedService = <>::Layer as Layer< + Upgrade>::Service>, +>>::Service; + impl Upgradable for Operation where // `Op` is used to specify the operation shape @@ -257,8 +258,8 @@ where // For `Route::new` for the resulting service >>::Service: Service, Error = Infallible>, - <>::Layer as Layer>::Service>>>::Service: Clone + Send + 'static, - <<>::Layer as Layer>::Service>>>::Service as Service>>::Future: Send + 'static, + UpgradedService: Clone + Send + 'static, + as Service>>::Future: Send + 'static, { /// Takes the [`Operation`](Operation), applies [`Plugin`], then applies [`UpgradeLayer`] to /// the modified `S`, then finally applies the modified `L`. @@ -284,7 +285,7 @@ pub struct FailOnMissingOperation; impl Upgradable for FailOnMissingOperation where InternalFailureException: IntoResponse

, - P: Send + 'static, + P: 'static, { fn upgrade(self, _plugin: &Pl) -> Route { Route::new(MissingFailure { _protocol: PhantomData }) @@ -292,8 +293,9 @@ where } /// A [`Service`] which always returns an internal failure message and logs an error. +#[derive(Copy)] pub struct MissingFailure

{ - _protocol: PhantomData

, + _protocol: PhantomData, } impl

Clone for MissingFailure

{