pub struct StateConfig {
pub storage_type: StateStorageType,
pub ttl: Duration,
pub cleanup_interval: Duration,
pub max_size: Option<usize>,
pub custom_storage: Option<Arc<dyn StateStorage + Send + Sync>>,
}Expand description
Configuration for state management
Fields§
§storage_type: StateStorageType§ttl: Duration§cleanup_interval: Duration§max_size: Option<usize>§custom_storage: Option<Arc<dyn StateStorage + Send + Sync>>Implementations§
Source§impl StateConfig
impl StateConfig
Sourcepub fn storage_type(self, storage_type: StateStorageType) -> Self
pub fn storage_type(self, storage_type: StateStorageType) -> Self
Set the storage type
Sourcepub fn cleanup_interval(self, interval: Duration) -> Self
pub fn cleanup_interval(self, interval: Duration) -> Self
Set the cleanup interval for expired entries
Sourcepub fn with_custom_storage(
self,
storage: Arc<dyn StateStorage + Send + Sync>,
) -> Self
pub fn with_custom_storage( self, storage: Arc<dyn StateStorage + Send + Sync>, ) -> Self
Set a custom storage backend
Sourcepub fn create_storage(&self) -> Box<dyn StateStorage + Send + Sync>
pub fn create_storage(&self) -> Box<dyn StateStorage + Send + Sync>
Create a storage instance from this configuration
Sourcepub fn create_storage_arc(&self) -> Arc<dyn StateStorage + Send + Sync>
pub fn create_storage_arc(&self) -> Arc<dyn StateStorage + Send + Sync>
Create a storage instance as Arc from this configuration
Trait Implementations§
Source§impl Clone for StateConfig
impl Clone for StateConfig
Source§fn clone(&self) -> StateConfig
fn clone(&self) -> StateConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for StateConfig
impl Debug for StateConfig
Auto Trait Implementations§
impl Freeze for StateConfig
impl !RefUnwindSafe for StateConfig
impl Send for StateConfig
impl Sync for StateConfig
impl Unpin for StateConfig
impl !UnwindSafe for StateConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more