diff --git a/CHANGELOG.next.toml b/CHANGELOG.next.toml index 5317cd5c7b192873545539451e5c660ba1c18fb3..0f769a2a24f98d33afdac7088770f30614b57b9a 100644 --- a/CHANGELOG.next.toml +++ b/CHANGELOG.next.toml @@ -239,3 +239,9 @@ message = "`SdkError` variants can now be constructed for easier unit testing." references = ["smithy-rs#2428", "smithy-rs#2208"] meta = { "breaking" = false, "tada" = true, "bug" = false, "target" = "client" } author = "jdisanti" + +[[smithy-rs]] +message = "Remove unnecessary type parameter `B` from `Upgrade` service." +references = ["smithy-rs#2436"] +meta = { "breaking" = true, "tada" = false, "bug" = false, "target" = "server" } +author = "hlbarber" diff --git a/design/src/server/anatomy.md b/design/src/server/anatomy.md index 794239d3bc27bfcb61da2cf2fc08b15568fa8ab2..394a0571661d7630e85cb022f3f4dd93c717b84e 100644 --- a/design/src/server/anatomy.md +++ b/design/src/server/anatomy.md @@ -301,7 +301,7 @@ where When we `GetPokemonService::from_handler` or `GetPokemonService::from_service`, the model service produced, `S`, will meet the constraints above. -There is an associated `Layer`, `UpgradeLayer
` which constructs `Upgrade` from a service. +There is an associated `Layer`, `UpgradeLayer
` which constructs `Upgrade` from a service.
The upgrade procedure is finalized by the application of the `Layer` `L`, referenced in `Operation Default for UpgradeLayer {
+impl Default for UpgradeLayer {
fn default() -> Self {
Self {
_protocol: PhantomData,
_operation: PhantomData,
_exts: PhantomData,
- _body: PhantomData,
}
}
}
-impl {
- type Service = Upgrade ;
+impl {
+ type Service = Upgrade ;
fn layer(&self, inner: S) -> Self::Service {
Upgrade {
_protocol: PhantomData,
_operation: PhantomData,
- _body: PhantomData,
_exts: PhantomData,
inner,
}
@@ -73,15 +70,14 @@ impl {
/// 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 Clone for Upgrade
+impl Clone for Upgrade
where
S: Clone,
{
@@ -89,7 +85,6 @@ where
Self {
_protocol: PhantomData,
_operation: PhantomData,
- _body: PhantomData,
_exts: PhantomData,
inner: self.inner.clone(),
}
@@ -177,7 +172,7 @@ where
}
}
-impl Service
+impl Service
where
// `Op` is used to specify the operation shape
Op: OperationShape,
@@ -225,9 +220,8 @@ pub trait Upgradable >::Service>,
->>::Service;
+type UpgradedService Upgradable for Operation ,
- // The modified Layer applies correctly to `Upgrade `
- Pl::Layer: Layer `
+ Pl::Layer: Layer`. In this way the entire upgrade procedure takes an `Operation` and returns a HTTP service.
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 cc38466c8cf1944de4aa92e85f2b3b710813ac7b..61e550ce84e5c86253e4ac128356622f4edd1277 100644
--- a/rust-runtime/aws-smithy-http-server/src/operation/upgrade.rs
+++ b/rust-runtime/aws-smithy-http-server/src/operation/upgrade.rs
@@ -32,39 +32,36 @@ use super::{Operation, OperationError, OperationShape};
///
/// See [`Upgrade`].
#[derive(Debug, Clone)]
-pub struct UpgradeLayer Layer for UpgradeLayer Layer for UpgradeLayer Layer for UpgradeLayer
where
@@ -250,17 +244,13 @@ where
// The plugin takes this operation as input
Pl: Plugin`](Operation), applies [`Plugin`], then applies [`UpgradeLayer`] to
/// the modified `S`, then finally applies the modified `L`.