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

Use optional_layer builder extension #408

Merged
merged 1 commit into from
Feb 8, 2021
Merged

Conversation

kazk
Copy link
Member

@kazk kazk commented Feb 8, 2021

Either::B(s)
}
}
}
Copy link
Member

Choose a reason for hiding this comment

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

Ah that is smart. Looks good to me.

Copy link
Member Author

@kazk kazk Feb 8, 2021

Choose a reason for hiding this comment

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

Yeah, they (authors of tower) make it look so simple and elegant. I thought it'll be more complex.

I might open a feature request to include this in tower.

Copy link
Member

Choose a reason for hiding this comment

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

yeah, that's a good idea. got two users now at least :-)

Copy link
Member Author

Choose a reason for hiding this comment

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

Got it merged 🎉 tower-rs/tower#555
I'll update when that's released.

fn optional_layer<T>(self, inner: Option<T>) -> ServiceBuilder<Stack<OptionalLayer<T>, L>> {
self.layer(OptionalLayer { inner })
}
}
Copy link
Member

Choose a reason for hiding this comment

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

nit: Do we technically need to define a ServiceBuilderExt trait for this if it's all private?

Copy link
Member Author

Choose a reason for hiding this comment

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

We need it to add the method to ServiceBuilder so we can use it in kube/src/service/mod.rs.

We can't just impl<L> ServiceBuilder<L> {} because ServiceBuilder is not defined in this crate.

Copy link
Member

Choose a reason for hiding this comment

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

ah, orphan rule again.

@clux clux merged commit 77e0e14 into kube-rs:master Feb 8, 2021
@kazk kazk deleted the optional-layer branch February 8, 2021 23:42
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.

2 participants