pub fn read_from_disk() -> Result<(CachingJar, CookieCacheState), CookieCacheError> {
        let path = get_cookie_cache_path()?;

        let contents = match read_to_string(path) {
            Ok(string) => Ok(string),
            Err(error) => {
                if let std::io::ErrorKind::NotFound = error.kind() {
                    Err(CookieCacheError::DoesNotExist)
                } else {
                    Err(error.into())
                }
            },
        }?;

        // deserialization implementation for CookieStore skips expired cookies internally
        let store: cookie_store::CookieStore = serde_json::from_str(&contents)?;

        // The cookie containing the actual authentication token is the one with the longest
        // expiration date, so even if *some* cookies are expired, reauthentication is only
        // required if *all* cookies are expired.
        if store.iter_unexpired().count() == 0 {
            log::info!("Session cookie(s) have expired, re-authentication necessary.");
            Ok((CachingJar::new(store), CookieCacheState::Expired))
        } else {
            log::debug!("Session cookie(s) are fresh, no re-authentication necessary.");
            Ok((CachingJar::new(store), CookieCacheState::Fresh))
        }
    }
/// Attempt to read cached persistent cookies from the on-disk cookie cache. If successful, the
/// return value is a tuple consisting of a new [CachingJar] instance, and a [CookieCacheState]
/// value indicating whether any of the cached cookies were expired or not.
Attempt to read cached persistent cookies from the on-disk cookie cache. If successful, the
return value is a tuple consisting of a new [CachingJar] instance, and a [CookieCacheState]
value indicating whether any of the cached cookies were expired or not.
Attempt to read cached persistent cookies from the on - disk cookie cache . If successful the return value is a tuple consisting of a new [ CachingJar ] instance and a [ CookieCacheState ] value indicating whether any of the cached cookies were expired or not .
pub fn read_from_disk() -> Result<(CachingJar, CookieCacheState), CookieCacheError> {
        let path = get_cookie_cache_path()?;
        let contents = match read_to_string(path) {
            Ok(string) => Ok(string),
            Err(error) => {
                if let std::io::ErrorKind::NotFound = error.kind() {
                    Err(CookieCacheError::DoesNotExist)
                } else {
                    Err(error.into())
                }
            },
        }?;
        // deserialization implementation for CookieStore skips expired cookies internally
        let store: cookie_store::CookieStore = serde_json::from_str(&contents)?;
        // The cookie containing the actual authentication token is the one with the longest
        // expiration date, so even if *some* cookies are expired, reauthentication is only
        // required if *all* cookies are expired.
        if store.iter_unexpired().count() == 0 {
            log::info!("Session cookie(s) have expired, re-authentication necessary.");
            Ok((CachingJar::new(store), CookieCacheState::Expired))
        } else {
            log::debug!("Session cookie(s) are fresh, no re-authentication necessary.");
            Ok((CachingJar::new(store), CookieCacheState::Fresh))
        }
    }
pub fn read_from_disk ( ) -> Result < ( CachingJar , CookieCacheState ) , CookieCacheError > { let path = get_cookie_cache_path ( ) ? ; let contents = match read_to_string ( path ) { Ok ( string ) => Ok ( string ) , Err ( error ) => { if let std :: io :: ErrorKind :: NotFound = error . kind ( ) { Err ( CookieCacheError :: DoesNotExist ) } else { Err ( error . into ( ) ) } } , } ? ; // deserialization implementation for CookieStore skips expired cookies internally let store : cookie_store :: CookieStore = serde_json :: from_str ( & contents ) ? ; // The cookie containing the actual authentication token is the one with the longest // expiration date, so even if *some* cookies are expired, reauthentication is only // required if *all* cookies are expired. if store . iter_unexpired ( ) . count ( ) == 0 { log :: info ! ( " " ) ; Ok ( ( CachingJar :: new ( store ) , CookieCacheState :: Expired ) ) } else { log :: debug ! ( " " ) ; Ok ( ( CachingJar :: new ( store ) , CookieCacheState :: Fresh ) ) } }
Attempt to read cached persistent cookies from the on-disk cookie cache.
Attempt to read cached persistent cookies from the on - disk cookie cache .