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:
parent
fbae63d07f
commit
140453c649
@ -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
|
||||
|
@ -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())
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user