Struct sessions_core::Session [−][src]
Session
Implementations
impl Session
[src]
pub fn new(id: &str, status: usize, config: Arc<Config>) -> Self
[src]
Creates new Session
with id
status
and Config
pub fn max_age(&self) -> Duration
[src]
Reads the session expires or cookie max_age
pub fn beer(&self) -> Result<RwLockReadGuard<'_, SessionBeer>>
[src]
Reads the session beer
pub fn beer_mut(&self) -> Result<RwLockWriteGuard<'_, SessionBeer>>
[src]
Writes the session beer
pub fn data(&self) -> Result<Data>
[src]
Reads the session state
pub fn set_data(&self, data: Data) -> Result<()>
[src]
Writes the session state
pub fn id(&self) -> Result<String>
[src]
Gets the session id
pub fn set_id(&self, id: &str) -> Result<()>
[src]
Gets the session id
pub fn data_status(&self) -> bool
[src]
Gets the session data status
pub fn status(&self) -> usize
[src]
Gets the session status
pub fn get<T: DeserializeOwned>(&self, key: &str) -> Option<T>
[src]
Gets a value by the key
pub fn set<T: DeserializeOwned + Serialize>(
&self,
key: &str,
val: T
) -> Option<T>
[src]
&self,
key: &str,
val: T
) -> Option<T>
Sets a value by the key
pub fn remove<T: DeserializeOwned>(&self, key: &str) -> Option<T>
[src]
Removes a value
pub fn clear(&self) -> Result<()>
[src]
Clears the state
pub async fn save(&self) -> Result<()>
[src]
Saves the current state to the store
pub async fn renew(&mut self) -> Result<()>
[src]
Renews the new state
pub async fn destroy(&self) -> Result<()>
[src]
Destroys the current state from store
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Session
impl Send for Session
impl Sync for Session
impl Unpin for Session
impl !UnwindSafe for Session
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,