Skip to content
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

util: Implement Layer for Either<A, B> #531

Merged
merged 2 commits into from
Jan 16, 2021

Conversation

davidpdrsn
Copy link
Member

I ran into a use case for this today which meant I had to make my own Either type. I guess makes sense for Tower to provide this directly.

My use case was that I wanted to optionally apply some layer depending on some config. I had an Option<T> which I wanted to map into a Either<LayerUsingT, Identity> and then treat that as a Layer in a larger stack.

@davidpdrsn davidpdrsn self-assigned this Jan 15, 2021
Copy link
Collaborator

@olix0r olix0r left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 LGTM

@davidpdrsn davidpdrsn merged commit af03a45 into master Jan 16, 2021
@davidpdrsn davidpdrsn deleted the david/impl-layer-for-either branch January 16, 2021 09:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants