pub struct FsUserCollection<T, U> {
pub users: DashMap<CompactString, User<T>>,
pub email_to_user: DashMap<CompactString, CompactString>,
pub other_data: U,
pub path: CompactString,
}Available on crate feature
integration-fs only.Fields§
§users: DashMap<CompactString, User<T>>§email_to_user: DashMap<CompactString, CompactString>§other_data: U§path: CompactStringImplementations§
Source§impl<T: DeserializeOwned + Serialize + Send + Sync, U: DeserializeOwned + Serialize + Send + Sync> FsUserCollection<T, U>
impl<T: DeserializeOwned + Serialize + Send + Sync, U: DeserializeOwned + Serialize + Send + Sync> FsUserCollection<T, U>
pub fn empty_at(path: impl AsRef<str>, other_data: U) -> Self
pub async fn read(path: impl AsRef<str>) -> Option<Result<Self, String>>
pub async fn write(&self)
pub fn remove_user(&self, username: &str) -> bool
pub fn change_user_password( &self, username: &str, password: &[u8], ) -> Result<(), ()>
Sourcepub fn map<NewT: DeserializeOwned + Serialize + Send + Sync, NewU: DeserializeOwned + Serialize + Send + Sync>(
self,
map_other_data: impl FnOnce(U, &DashMap<CompactString, User<NewT>>) -> NewU,
map_user_data: impl FnMut(T, &U) -> NewT,
) -> FsUserCollection<NewT, NewU>
pub fn map<NewT: DeserializeOwned + Serialize + Send + Sync, NewU: DeserializeOwned + Serialize + Send + Sync>( self, map_other_data: impl FnOnce(U, &DashMap<CompactString, User<NewT>>) -> NewU, map_user_data: impl FnMut(T, &U) -> NewT, ) -> FsUserCollection<NewT, NewU>
Change types of all data. Useful for “upgrading” the data scheme
Please keep in mind that the other_data passwed to map_user_data is not upgraded
Trait Implementations§
Source§impl<'de, T, U> Deserialize<'de> for FsUserCollection<T, U>where
T: Deserialize<'de>,
U: Deserialize<'de>,
impl<'de, T, U> Deserialize<'de> for FsUserCollection<T, U>where
T: Deserialize<'de>,
U: Deserialize<'de>,
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<T, U> Freeze for FsUserCollection<T, U>where
U: Freeze,
impl<T, U> !RefUnwindSafe for FsUserCollection<T, U>
impl<T, U> Send for FsUserCollection<T, U>
impl<T, U> Sync for FsUserCollection<T, U>
impl<T, U> Unpin for FsUserCollection<T, U>where
U: Unpin,
impl<T, U> UnwindSafe for FsUserCollection<T, U>where
U: UnwindSafe,
T: UnwindSafe,
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