Struct mailpot_web::AuthMemoryStore
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§
§impl<UserId, User> MemoryStore<UserId, User>
impl<UserId, User> MemoryStore<UserId, User>
pub 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§
§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,
§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 more§impl<UserId, User> Debug for MemoryStore<UserId, User>where
UserId: Debug,
User: Debug,
impl<UserId, User> Debug for MemoryStore<UserId, User>where UserId: Debug, User: Debug,
§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,
§fn default() -> MemoryStore<UserId, User>
fn default() -> MemoryStore<UserId, User>
Returns the “default value” for a type. Read more
§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>,
§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