client-api: Add UserIdentifier::email
This commit is contained in:
parent
0661078c17
commit
24c0a08b2c
@ -3,6 +3,7 @@
|
||||
Improvements:
|
||||
|
||||
* Add `From<&UserId>` and `From<&OwnedUserId>` implementations for `UserIdentifier`
|
||||
* Add `UserIdentifier::email` constructor
|
||||
|
||||
# 0.14.0
|
||||
|
||||
|
@ -590,6 +590,13 @@ pub enum UserIdentifier<'a> {
|
||||
},
|
||||
}
|
||||
|
||||
impl<'a> UserIdentifier<'a> {
|
||||
/// Creates a [`UserIdentifier::ThirdPartyId`] from an email address.
|
||||
pub fn email(address: &'a str) -> Self {
|
||||
Self::ThirdPartyId { address, medium: Medium::Email }
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> From<&'a UserId> for UserIdentifier<'a> {
|
||||
fn from(id: &'a UserId) -> Self {
|
||||
Self::UserIdOrLocalpart(id.as_str())
|
||||
|
Loading…
x
Reference in New Issue
Block a user