Enum bonsaidb::core::connection::IdentityReference
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§
§impl<'name> IdentityReference<'name>
impl<'name> IdentityReference<'name>
pub fn user<User>(user: User) -> Result<IdentityReference<'name>, Error>where
User: Nameable<'name, u64>,
pub fn user<User>(user: User) -> Result<IdentityReference<'name>, Error>where User: Nameable<'name, u64>,
Returns a reference to a User
. This function accepts either the
user’s unique id or their username.
pub fn role<Role>(role: Role) -> Result<IdentityReference<'name>, Error>where
Role: Nameable<'name, u64>,
pub fn role<Role>(role: Role) -> Result<IdentityReference<'name>, Error>where Role: Nameable<'name, u64>,
Returns a reference to a Role
. This function accepts either the
role’s unique id or the role’s name.
pub fn into_owned(self) -> IdentityReference<'static>
pub fn into_owned(self) -> IdentityReference<'static>
Converts this reference to an owned reference with a 'static
lifetime.
pub fn resolve<C>(&self, admin: &C) -> Result<Option<IdentityId>, Error>where
C: Connection,
pub fn resolve<C>(&self, admin: &C) -> Result<Option<IdentityId>, Error>where C: Connection,
Resolves this reference to the unique id.
pub async fn resolve_async<C>(
&self,
admin: &C
) -> impl Future<Output = Result<Option<IdentityId>, Error>>where
C: AsyncConnection,
pub async fn resolve_async<C>( &self, admin: &C ) -> impl Future<Output = Result<Option<IdentityId>, Error>>where C: AsyncConnection,
Resolves this reference to the unique id.
Trait Implementations§
§impl<'name> Clone for IdentityReference<'name>
impl<'name> Clone for IdentityReference<'name>
§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 more§impl<'name> Debug for IdentityReference<'name>
impl<'name> Debug for IdentityReference<'name>
§impl<'de, 'name> Deserialize<'de> for IdentityReference<'name>
impl<'de, 'name> Deserialize<'de> for IdentityReference<'name>
§fn deserialize<__D>(
__deserializer: __D
) -> Result<IdentityReference<'name>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>( __deserializer: __D ) -> Result<IdentityReference<'name>, <__D as Deserializer<'de>>::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
§impl<'name> Serialize for IdentityReference<'name>
impl<'name> Serialize for IdentityReference<'name>
§fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>( &self, __serializer: __S ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where __S: Serializer,
Serialize this value into the given Serde serializer. 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§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere T: 'a,
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