mirror of https://github.com/fafhrd91/actix-web
re-add deprecated to Condition::new remove breaking changes.
This commit is contained in:
parent
613be74faf
commit
4a45606b9f
|
@ -8,7 +8,7 @@
|
|||
### Changed
|
||||
* Associated type `FromRequest::Config` was removed. [#2233]
|
||||
* Inner field made private on `web::Payload`. [#2384]
|
||||
* `middleware::Condition::new` was removed in favour of `middleware::conditionally`
|
||||
* `middleware::Condition::new` was deprecated in favour of `middleware::conditionally`
|
||||
|
||||
[#2233]: https://github.com/actix/actix-web/pull/2233
|
||||
[#2362]: https://github.com/actix/actix-web/pull/2362
|
||||
|
|
|
@ -18,7 +18,7 @@ use std::sync::Mutex;
|
|||
///
|
||||
/// # Examples
|
||||
/// ```
|
||||
/// use actix_web::middleware::{Condition, NormalizePath, TrailingSlash, conditionally, optionally, optionally_fut};
|
||||
/// use actix_web::middleware::{Condition, NormalizePath, TrailingSlash, conditionally, optionally, optionally_fut, futurally};
|
||||
/// use actix_web::App;
|
||||
/// use std::future::ready;
|
||||
///
|
||||
|
@ -38,6 +38,13 @@ pub struct Condition<T, F>(Rc<Mutex<F>>)
|
|||
where
|
||||
F: Future<Output = Option<T>> + Unpin + 'static;
|
||||
|
||||
impl<T> Condition<T, Ready<Option<T>>> {
|
||||
#[deprecated(since = "4.0.0", note = "Use middleware::conditionally instead")]
|
||||
pub fn new(enable: bool, transformer: T) -> Self {
|
||||
conditionally(enable, transformer)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn futurally<T, F>(transformer: F) -> Condition<T, F>
|
||||
where
|
||||
F: Future<Output = Option<T>> + Unpin + 'static,
|
||||
|
|
Loading…
Reference in New Issue