pub trait TestStoreFactory: Send + Sync {
// Required method
fn create_store<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Box<dyn MessageStore>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided method
fn is_persistent(&self) -> bool { ... }
}Expand description
A factory trait for creating message store instances during testing.
Implement this trait for each message store implementation you want to test. The test functions in this module will use this factory to create fresh store instances for each test.
Required Methods§
Sourcefn create_store<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Box<dyn MessageStore>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn create_store<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Box<dyn MessageStore>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Creates a new message store instance.
For persistent stores, this should return a store that can be
reopened with the same data (by calling create_store again).
Provided Methods§
Sourcefn is_persistent(&self) -> bool
fn is_persistent(&self) -> bool
Returns true if the store persists data across restarts.
This is used to skip persistence-related tests for in-memory stores.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".