#[non_exhaustive]pub enum IdentityReference<'name> {
User(NamedReference<'name, u64>),
Role(NamedReference<'name, u64>),
}Expand description
A reference to an identity.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
User(NamedReference<'name, u64>)
A reference to a User.
Role(NamedReference<'name, u64>)
A reference to a Role.
Implementations§
Source§impl<'name> IdentityReference<'name>
impl<'name> IdentityReference<'name>
Sourcepub fn user<User: Nameable<'name, u64>>(user: User) -> Result<Self, Error>
pub fn user<User: Nameable<'name, u64>>(user: User) -> Result<Self, Error>
Returns a reference to a User. This function accepts either the
user’s unique id or their username.
Sourcepub fn role<Role: Nameable<'name, u64>>(role: Role) -> Result<Self, Error>
pub fn role<Role: Nameable<'name, u64>>(role: Role) -> Result<Self, Error>
Returns a reference to a Role. This function accepts either the
role’s unique id or the role’s name.
Sourcepub fn into_owned(self) -> IdentityReference<'static>
pub fn into_owned(self) -> IdentityReference<'static>
Converts this reference to an owned reference with a 'static lifetime.
Sourcepub fn resolve<C: Connection>(
&self,
admin: &C,
) -> Result<Option<IdentityId>, Error>
pub fn resolve<C: Connection>( &self, admin: &C, ) -> Result<Option<IdentityId>, Error>
Resolves this reference to the unique id.
Sourcepub async fn resolve_async<C: AsyncConnection>(
&self,
admin: &C,
) -> Result<Option<IdentityId>, Error>
pub async fn resolve_async<C: AsyncConnection>( &self, admin: &C, ) -> Result<Option<IdentityId>, Error>
Resolves this reference to the unique id.
Trait Implementations§
Source§impl<'name> Clone for IdentityReference<'name>
impl<'name> Clone for IdentityReference<'name>
Source§fn clone(&self) -> IdentityReference<'name>
fn clone(&self) -> IdentityReference<'name>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<'name> Debug for IdentityReference<'name>
impl<'name> Debug for IdentityReference<'name>
Source§impl<'de, 'name> Deserialize<'de> for IdentityReference<'name>
impl<'de, 'name> Deserialize<'de> for IdentityReference<'name>
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl<'name> Freeze for IdentityReference<'name>
impl<'name> RefUnwindSafe for IdentityReference<'name>
impl<'name> Send for IdentityReference<'name>
impl<'name> Sync for IdentityReference<'name>
impl<'name> Unpin for IdentityReference<'name>
impl<'name> UnwindSafe for IdentityReference<'name>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more