pub struct AuthStateService<'a, C> { /* private fields */ }Expand description
AuthStateService is the service for the auth state.
Implementations§
Source§impl<'a, C> AuthStateService<'a, C>where
C: PocketBaseClient + Sized,
impl<'a, C> AuthStateService<'a, C>where
C: PocketBaseClient + Sized,
Sourcepub fn new(
client: &'a mut C,
token_key: &'a str,
user_or_admin_key: &'a str,
) -> Self
pub fn new( client: &'a mut C, token_key: &'a str, user_or_admin_key: &'a str, ) -> Self
create a new AuthStateService with custom keys.
pub async fn get_user_or_admin( &self, ) -> Result<Option<AuthPayload>, RPocketError>
Sourcepub async fn clear(&self) -> Result<(), RPocketError>
pub async fn clear(&self) -> Result<(), RPocketError>
clear the storage.
pub async fn save( &self, token: &str, record: &AuthPayload, ) -> Result<(), RPocketError>
Auto Trait Implementations§
impl<'a, C> Freeze for AuthStateService<'a, C>
impl<'a, C> RefUnwindSafe for AuthStateService<'a, C>where
C: RefUnwindSafe,
impl<'a, C> Send for AuthStateService<'a, C>where
C: Send,
impl<'a, C> Sync for AuthStateService<'a, C>where
C: Sync,
impl<'a, C> Unpin for AuthStateService<'a, C>
impl<'a, C> !UnwindSafe for AuthStateService<'a, C>
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