Compare commits

...

4 Commits

Author SHA1 Message Date
Guillermo Céspedes Tabárez c4be19942b ci: downgrade for msrv zerofrom to version 0.1.5 in justfile 2025-03-03 16:25:50 -03:00
Guillermo Céspedes Tabárez acd7c58097 chore: update changelog and fix docs for CI 2025-03-03 16:12:31 -03:00
Guillermo Céspedes Tabárez 176ea5da77 ci: downgrade for msrv litemap to version 0.7.4 in justfile 2025-03-03 16:05:01 -03:00
Guillermo Céspedes Tabárez 91fa813f0e fix(guards): replace take_guards with get_guards to prevent guard removal and fix test failures 2025-03-03 15:31:20 -03:00
5 changed files with 12 additions and 4 deletions

View File

@ -2,6 +2,7 @@
## Unreleased
- Add `resources-introspection` feature for retrieving configured route paths and HTTP methods.
- Implement `Responder` for `Result<(), E: Into<Error>>`. Returning `Ok(())` responds with HTTP 204 No Content.
- On Windows, an error is now returned from `HttpServer::bind()` (or TLS variants) when binding to a socket that's already in use.
- Update `brotli` dependency to `7`.

View File

@ -11,7 +11,7 @@
//! or handler. This interface is defined by the [`Guard`] trait.
//!
//! Commonly-used guards are provided in this module as well as a way of creating a guard from a
//! closure ([`fn_guard`]). The [`Not`], [`Any`], and [`All`] guards are noteworthy, as they can be
//! closure ([`fn_guard`]). The [`Not`], [`Any()`], and [`All`] guards are noteworthy, as they can be
//! used to compose other guards in a more flexible and semantic way than calling `.guard(...)` on
//! services multiple times (which might have different combining behavior than you want).
//!
@ -196,7 +196,7 @@ pub fn Any<F: Guard + 'static>(guard: F) -> AnyGuard {
///
/// That is, only one contained guard needs to match in order for the aggregate guard to match.
///
/// Construct an `AnyGuard` using [`Any`].
/// Construct an `AnyGuard` using [`Any()`].
pub struct AnyGuard {
guards: Vec<Box<dyn Guard>>,
}

View File

@ -442,8 +442,8 @@ where
{
rmap.add(&mut rdef, None);
self.routes.iter_mut().for_each(|r| {
r.take_guards().iter().for_each(|g| {
self.routes.iter().for_each(|r| {
r.get_guards().iter().for_each(|g| {
let http_methods: Vec<String> =
crate::guard::HttpMethodsExtractor::extract_http_methods(&**g);
rdef_methods

View File

@ -65,6 +65,11 @@ impl Route {
pub(crate) fn take_guards(&mut self) -> Vec<Box<dyn Guard>> {
mem::take(Rc::get_mut(&mut self.guards).unwrap())
}
#[cfg(feature = "resources-introspection")]
pub(crate) fn get_guards(&self) -> &Vec<Box<dyn Guard>> {
&self.guards
}
}
impl ServiceFactory<ServiceRequest> for Route {

View File

@ -13,6 +13,8 @@ downgrade-for-msrv:
cargo update -p=parse-size --precise=1.0.0
cargo update -p=clap --precise=4.4.18
cargo update -p=divan --precise=0.1.15
cargo update -p=litemap --precise=0.7.4
cargo update -p=zerofrom --precise=0.1.5
msrv := ```
cargo metadata --format-version=1 \