mirror of
https://github.com/tokio-rs/axum.git
synced 2025-01-03 17:52:18 +01:00
Add AddExtension::layer (#607)
This commit is contained in:
parent
c8c0bb2ce1
commit
b1623ce7f2
2 changed files with 11 additions and 2 deletions
|
@ -7,7 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
|
|
||||||
# Unreleased
|
# Unreleased
|
||||||
|
|
||||||
- None.
|
- **added:** `axum::AddExtension::layer` ([#607])
|
||||||
|
|
||||||
|
[#607]: https://github.com/tokio-rs/axum/pull/607
|
||||||
|
|
||||||
# 0.4.2 (06. December, 2021)
|
# 0.4.2 (06. December, 2021)
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ pub struct AddExtensionLayer<T> {
|
||||||
impl<T> AddExtensionLayer<T> {
|
impl<T> AddExtensionLayer<T> {
|
||||||
/// Create a new [`AddExtensionLayer`].
|
/// Create a new [`AddExtensionLayer`].
|
||||||
pub fn new(value: T) -> Self {
|
pub fn new(value: T) -> Self {
|
||||||
AddExtensionLayer { value }
|
Self { value }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,6 +49,13 @@ pub struct AddExtension<S, T> {
|
||||||
value: T,
|
value: T,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<S, T> AddExtension<S, T> {
|
||||||
|
/// Create a new [`AddExtensionLayer`].
|
||||||
|
pub fn layer(value: T) -> AddExtensionLayer<T> {
|
||||||
|
AddExtensionLayer::new(value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl<ResBody, S, T> Service<Request<ResBody>> for AddExtension<S, T>
|
impl<ResBody, S, T> Service<Request<ResBody>> for AddExtension<S, T>
|
||||||
where
|
where
|
||||||
S: Service<Request<ResBody>>,
|
S: Service<Request<ResBody>>,
|
||||||
|
|
Loading…
Reference in a new issue