pub struct SessionManager { /* private fields */ }Expand description
Manages session persistence and validation using lastfm-edit’s SessionManager
Implementations§
Source§impl SessionManager
impl SessionManager
Sourcepub fn load_session(&self) -> Option<LastFmEditSession>
pub fn load_session(&self) -> Option<LastFmEditSession>
Try to load an existing session from disk
Sourcepub fn save_session(&self, session: &LastFmEditSession) -> Result<(), Error>
pub fn save_session(&self, session: &LastFmEditSession) -> Result<(), Error>
Save a session to disk
Sourcepub async fn validate_session(&self, session: &LastFmEditSession) -> bool
pub async fn validate_session(&self, session: &LastFmEditSession) -> bool
Validate if a session is still working by making a test request to settings page
Sourcepub fn clear_session(&self) -> Result<(), Error>
pub fn clear_session(&self) -> Result<(), Error>
Remove the saved session file
Sourcepub async fn try_restore_session(&self) -> Option<LastFmEditSession>
pub async fn try_restore_session(&self) -> Option<LastFmEditSession>
Try to restore a working session, validating it if necessary
Sourcepub async fn create_and_save_session(
&self,
username: &str,
password: &str,
) -> LastFmResult<LastFmEditSession>
pub async fn create_and_save_session( &self, username: &str, password: &str, ) -> LastFmResult<LastFmEditSession>
Create and save a new session after successful login
Auto Trait Implementations§
impl Freeze for SessionManager
impl RefUnwindSafe for SessionManager
impl Send for SessionManager
impl Sync for SessionManager
impl Unpin for SessionManager
impl UnsafeUnpin for SessionManager
impl UnwindSafe for SessionManager
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