#[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 copy 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> 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