pub trait Session:
Send
+ Sync
+ Debug {
// Required methods
fn session_id(&self) -> &str;
fn get_items<'life0, 'async_trait>(
&'life0 self,
limit: Option<usize>,
) -> Pin<Box<dyn Future<Output = Result<Vec<RunItem>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn add_items<'life0, 'async_trait>(
&'life0 self,
items: Vec<RunItem>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn pop_item<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<RunItem>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn clear_session<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided method
fn get_messages<'life0, 'async_trait>(
&'life0 self,
limit: Option<usize>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Message>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
}Expand description
Defines the interface for session storage implementations.
Required Methods§
Sourcefn session_id(&self) -> &str
fn session_id(&self) -> &str
Returns the unique identifier for the session.
Sourcefn get_items<'life0, 'async_trait>(
&'life0 self,
limit: Option<usize>,
) -> Pin<Box<dyn Future<Output = Result<Vec<RunItem>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_items<'life0, 'async_trait>(
&'life0 self,
limit: Option<usize>,
) -> Pin<Box<dyn Future<Output = Result<Vec<RunItem>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Retrieves a list of RunItems from the session.
Sourcefn add_items<'life0, 'async_trait>(
&'life0 self,
items: Vec<RunItem>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn add_items<'life0, 'async_trait>(
&'life0 self,
items: Vec<RunItem>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Adds a vector of RunItems to the session.