Skip to main content

SessionSlot

Trait SessionSlot 

Source
pub trait SessionSlot: Send + Sync {
    // Required methods
    fn id(&self) -> &str;
    fn load<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = GrabResult<Option<Value>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn save<'life0, 'life1, 'async_trait>(
        &'life0 self,
        session: &'life1 Value,
    ) -> Pin<Box<dyn Future<Output = GrabResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn load_cart<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = GrabResult<Option<Value>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn save_cart<'life0, 'life1, 'async_trait>(
        &'life0 self,
        cart: Option<&'life1 Value>,
    ) -> Pin<Box<dyn Future<Output = GrabResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

An account’s session, wherever the service keeps it (sealed, ideally): read and written only through this (the client’s refreshes save here).

Required Methods§

Source

fn id(&self) -> &str

Whose (the account’s key): keys what the backend keeps per account.

Source

fn load<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = GrabResult<Option<Value>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

The session (none: not connected).

Source

fn save<'life0, 'life1, 'async_trait>( &'life0 self, session: &'life1 Value, ) -> Pin<Box<dyn Future<Output = GrabResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Keep the session (a refresh renewed it).

Source

fn load_cart<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = GrabResult<Option<Value>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

The backend’s cart, kept beside the session (none: empty).

Source

fn save_cart<'life0, 'life1, 'async_trait>( &'life0 self, cart: Option<&'life1 Value>, ) -> Pin<Box<dyn Future<Output = GrabResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Keep (none: drop) the cart.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§