1
0
mirror of https://github.com/actix/actix-extras.git synced 2024-11-27 09:12:57 +01:00

Return &str from BasicAuth::user_id() and BasicAuth::password() (#249)

Co-authored-by: Rob Ede <robjtede@icloud.com>
This commit is contained in:
Mike Cronce 2022-07-18 21:33:32 -04:00 committed by GitHub
parent fbae63d07f
commit 140453c649
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 4 deletions

View File

@ -1,6 +1,10 @@
# Changes
## Unreleased - 2022-xx-xx
- `BasicAuth::user_id()` now returns a `&str`. [#249]
- `BasicAuth::password()` now returns a `&str`. [#249]
[#249]: https://github.com/actix/actix-extras/pull/249
## 0.7.0 - 2022-07-19

View File

@ -93,13 +93,13 @@ pub struct BasicAuth(Basic);
impl BasicAuth {
/// Returns client's user-ID.
pub fn user_id(&self) -> &Cow<'static, str> {
self.0.user_id()
pub fn user_id(&self) -> &str {
self.0.user_id().as_ref()
}
/// Returns client's password.
pub fn password(&self) -> Option<&Cow<'static, str>> {
self.0.password()
pub fn password(&self) -> Option<&str> {
self.0.password().map(|s| s.as_ref())
}
}