pub struct FileStore {
pub dir: &'static str,
pub prefix: &'static str,
pub extension: &'static str,
}Expand description
Creates a FileStore struct and stores its configuration. Specifying the dir, prefix, and
extension fields will define how session.
For example, if you were to use:
FileStore::new("/path/to/sesssions/directory", "prefix-", ".json")to instantiate a new FileStore struct, then you would end up with files such as:
/path/to/sesssions/directory/prefix-CI4afkzk6tVMRb50lMyZAA.json
/path/to/sesssions/directory/prefix-Hs8Jb0_zAGrc_rmUYGwlvw.json
/path/to/sesssions/directory/prefix-swJdTjvk1os8zAhhc6AVMQ.jsonFields§
§dir: &'static strDirectory to use for session storage. Omit any trailing slashes or path separators.
prefix: &'static strOptional prefix for session files. If not empty, all files will begin with this prefix
extension: &'static strImplementations§
Source§impl FileStore
impl FileStore
Sourcepub fn new(
dir: &'static str,
prefix: &'static str,
extension: &'static str,
) -> Self
pub fn new( dir: &'static str, prefix: &'static str, extension: &'static str, ) -> Self
Creates a new FileStore struct with the specified dir, prefix, and extensions fields.
Trait Implementations§
Source§impl SessionStore for FileStore
Implementation of tower_sessions::SessionStore
This powers the session storage and deletion system.
Note that the self.save() and self.path() calls refer to impl FileStore
impl SessionStore for FileStore
Implementation of tower_sessions::SessionStore
This powers the session storage and deletion system.
Note that the self.save() and self.path() calls refer to impl FileStore
Source§fn create<'life0, 'life1, 'async_trait>(
&'life0 self,
record: &'life1 mut Record,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn create<'life0, 'life1, 'async_trait>(
&'life0 self,
record: &'life1 mut Record,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Creates a new session in the store with the provided session record. Read more
Source§fn save<'life0, 'life1, 'async_trait>(
&'life0 self,
record: &'life1 Record,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn save<'life0, 'life1, 'async_trait>(
&'life0 self,
record: &'life1 Record,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Saves the provided session record to the store. Read more
Source§fn load<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 Id,
) -> Pin<Box<dyn Future<Output = Result<Option<Record>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn load<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 Id,
) -> Pin<Box<dyn Future<Output = Result<Option<Record>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Loads an existing session record from the store using the provided ID. Read more
Auto Trait Implementations§
impl Freeze for FileStore
impl RefUnwindSafe for FileStore
impl Send for FileStore
impl Sync for FileStore
impl Unpin for FileStore
impl UnwindSafe for FileStore
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