Struct mailpot_web::AuthMemoryStore
source · pub struct AuthMemoryStore<UserId, User> {
inner: Arc<RwLock<HashMap<UserId, User, RandomState>>>,
}
Expand description
An ephemeral store, useful for testing and demonstration purposes.
Fields§
§inner: Arc<RwLock<HashMap<UserId, User, RandomState>>>
Implementations§
source§impl<UserId, User> MemoryStore<UserId, User>
impl<UserId, User> MemoryStore<UserId, User>
sourcepub fn new(
inner: &Arc<RwLock<HashMap<UserId, User, RandomState>>>
) -> MemoryStore<UserId, User>
pub fn new( inner: &Arc<RwLock<HashMap<UserId, User, RandomState>>> ) -> MemoryStore<UserId, User>
Creates a new memory store.
use std::{collections::HashMap, sync::Arc};
use axum_login::memory_store::MemoryStore;
use tokio::sync::RwLock;
let inner = Arc::new(RwLock::new(HashMap::<String, ()>::new()));
let memory_store = MemoryStore::new(&inner);
Trait Implementations§
source§impl<UserId, User> Clone for MemoryStore<UserId, User>where
UserId: Clone,
User: Clone,
impl<UserId, User> Clone for MemoryStore<UserId, User>where UserId: Clone, User: Clone,
source§fn clone(&self) -> MemoryStore<UserId, User>
fn clone(&self) -> MemoryStore<UserId, User>
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<UserId, User> Default for MemoryStore<UserId, User>where
UserId: Default,
User: Default,
impl<UserId, User> Default for MemoryStore<UserId, User>where UserId: Default, User: Default,
source§fn default() -> MemoryStore<UserId, User>
fn default() -> MemoryStore<UserId, User>
Returns the “default value” for a type. Read more
source§impl<UserId, User, Role> UserStore<UserId, Role> for MemoryStore<UserId, User>where
UserId: Eq + Clone + Send + Sync + Hash + 'static,
Role: PartialOrd<Role> + PartialEq<Role> + Clone + Send + Sync + 'static,
User: AuthUser<UserId, Role>,
impl<UserId, User, Role> UserStore<UserId, Role> for MemoryStore<UserId, User>where UserId: Eq + Clone + Send + Sync + Hash + 'static, Role: PartialOrd<Role> + PartialEq<Role> + Clone + Send + Sync + 'static, User: AuthUser<UserId, Role>,
source§fn load_user<'life0, 'life1, 'async_trait>(
&'life0 self,
user_id: &'life1 UserId
) -> Pin<Box<dyn Future<Output = Result<Option<<MemoryStore<UserId, User> as UserStore<UserId, Role>>::User>, Report>> + Send + 'async_trait, Global>>where
'life0: 'async_trait,
'life1: 'async_trait,
MemoryStore<UserId, User>: 'async_trait,
fn load_user<'life0, 'life1, 'async_trait>( &'life0 self, user_id: &'life1 UserId ) -> Pin<Box<dyn Future<Output = Result<Option<<MemoryStore<UserId, User> as UserStore<UserId, Role>>::User>, Report>> + Send + 'async_trait, Global>>where 'life0: 'async_trait, 'life1: 'async_trait, MemoryStore<UserId, User>: 'async_trait,
Load and return a user. Read more
Auto Trait Implementations§
impl<UserId, User> !RefUnwindSafe for MemoryStore<UserId, User>
impl<UserId, User> Send for MemoryStore<UserId, User>where User: Send + Sync, UserId: Send + Sync,
impl<UserId, User> Sync for MemoryStore<UserId, User>where User: Send + Sync, UserId: Send + Sync,
impl<UserId, User> Unpin for MemoryStore<UserId, User>
impl<UserId, User> !UnwindSafe for MemoryStore<UserId, User>
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