From 55ace79d6455e667620f401f83c95c6bee8b9ad8 Mon Sep 17 00:00:00 2001 From: Max Karou Date: Sat, 16 Sep 2023 02:27:50 +0200 Subject: [PATCH] Implement `From` for `BasicAuth` (#327) * implement `From` for `BasicAuth` * update changelog --------- Co-authored-by: Rob Ede --- actix-web-httpauth/CHANGES.md | 1 + actix-web-httpauth/src/extractors/basic.rs | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/actix-web-httpauth/CHANGES.md b/actix-web-httpauth/CHANGES.md index 8f973f4f6..d307ad7d6 100644 --- a/actix-web-httpauth/CHANGES.md +++ b/actix-web-httpauth/CHANGES.md @@ -2,6 +2,7 @@ ## Unreleased +- Implement `From` for `BasicAuth`. - Minimum supported Rust version (MSRV) is now 1.68. ## 0.8.0 diff --git a/actix-web-httpauth/src/extractors/basic.rs b/actix-web-httpauth/src/extractors/basic.rs index 97890dda2..8b0f39ee8 100644 --- a/actix-web-httpauth/src/extractors/basic.rs +++ b/actix-web-httpauth/src/extractors/basic.rs @@ -89,6 +89,12 @@ impl BasicAuth { } } +impl From for BasicAuth { + fn from(basic: Basic) -> Self { + Self(basic) + } +} + impl FromRequest for BasicAuth { type Future = Ready>; type Error = AuthenticationError;