[][src]Struct sessions_core::Session

pub struct Session {
    pub id: String,
    pub status: Arc<AtomicUsize>,
    // some fields omitted
}

Session

Fields

id: String

Session's id

status: Arc<AtomicUsize>

Session's status

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 data(&self) -> Result<RwLockReadGuard<'_, Data>>[src]

Reads the session state

pub fn data_mut(&self) -> Result<RwLockWriteGuard<'_, Data>>[src]

Writes the session state

pub fn id(&self) -> String[src]

Gets the session id

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]

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

impl Clone for Session[src]

impl Debug for Session[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.