-
Notifications
You must be signed in to change notification settings - Fork 190
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use a bespoke version of Either
#2441
Conversation
A new generated diff is ready to view.
A new doc preview is ready to view. |
@@ -119,6 +119,7 @@ | |||
//! | |||
|
|||
mod closure; | |||
pub mod either; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I should probably pull Either
into this module actually, rather than pub mod
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I would put Either
in its own util
module like tower does (given that Either
is not just a Plugin
, but a Service/Layer/Plugin
combinator).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah that could work except all these Plugin
s are kinda util
s though?
Stack
FilterByOperationName
OperationNameFn
The only non-util
Plugin
in this repo is the InstrumentPlugin
which lives in a different module - src/instrument/plugin.rs
.
A new generated diff is ready to view.
A new doc preview is ready to view. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current (tower 0.4.13) behaviour of tower's Either
seems to be unintended, see this PR that changes it. It looks like we could use their type after that fix is released in 0.5 or 1.0, so let's keep an eye on that.
I think this is fine to merge in the meantime.
@@ -119,6 +119,7 @@ | |||
//! | |||
|
|||
mod closure; | |||
pub mod either; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I would put Either
in its own util
module like tower does (given that Either
is not just a Plugin
, but a Service/Layer/Plugin
combinator).
A new generated diff is ready to view.
A new doc preview is ready to view. |
Motivation and Context
https://docs.rs/tower/latest/tower/util/enum.Either.html
This is not the case, the error types are not required to be the same - as seen in the actual
Service
implementation. Thetower::util::Either
instead takes either error and converts it toBox<dyn Error>
which is not the intended behavior and conflicts with the contract of Smithy which wants eitherInfallible
in the case of a HTTP middleware andOp::Error
in the case of a model middleware.Description
Either
which preserves error.Plugin
implementation forPlugin
.Either
forFilterByOperationName
.