diff options
author | Sam Scott <sam@osohq.com> | 2024-04-07 15:23:28 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-07 15:23:28 -0500 |
commit | 2bb118fce16f2d5a1a85fce96d228acc23df827e (patch) | |
tree | 56ca89d79ba4d959f365004df5ab134adf79ac68 /src/actix.rs | |
parent | c6e5914a31e0d602695a3ea601f6976a1ab07d0e (diff) |
Fix MSRV (#99)
* Remove `then_some` to stay compatible with earlier versions of Rust
* Fix CI builds to build on old versions of Rust
* Trying 1.61
Diffstat (limited to 'src/actix.rs')
-rw-r--r-- | src/actix.rs | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/src/actix.rs b/src/actix.rs index 176ce7d..02e9ae8 100644 --- a/src/actix.rs +++ b/src/actix.rs @@ -134,6 +134,8 @@ where } } +type ActixErrorHandler = Option<Arc<dyn Fn(QsError, &HttpRequest) -> ActixError + Send + Sync>>; + /// Query extractor configuration /// /// ```rust @@ -173,9 +175,9 @@ where /// ); /// } /// ``` -#[derive(Clone)] +#[derive(Clone, Default)] pub struct QsQueryConfig { - ehandler: Option<Arc<dyn Fn(QsError, &HttpRequest) -> ActixError + Send + Sync>>, + ehandler: ActixErrorHandler, qs_config: QsConfig, } @@ -201,15 +203,6 @@ impl QsQueryConfig { } } -impl Default for QsQueryConfig { - fn default() -> Self { - QsQueryConfig { - ehandler: None, - qs_config: QsConfig::default(), - } - } -} - #[derive(PartialEq, Eq, PartialOrd, Ord)] /// Extract typed information from from the request's form data. /// @@ -230,7 +223,7 @@ impl Default for QsQueryConfig { /// } /// /// // Use `QsForm` extractor for Form information. -/// // Content-Type: application/x-www-form-urlencoded +/// // Content-Type: application/x-www-form-urlencoded /// // The correct request payload for this handler would be `id[]=1124&id[]=88` /// async fn filter_users(info: QsForm<UsersFilter>) -> HttpResponse { /// HttpResponse::Ok().body( |