SettingsRepository

Trait SettingsRepository 

Source
pub trait SettingsRepository: Send + Sync {
    // Required methods
    fn load<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Settings, RepositoryError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn save<'life0, 'life1, 'async_trait>(
        &'life0 self,
        settings: &'life1 Settings,
    ) -> Pin<Box<dyn Future<Output = Result<(), RepositoryError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Repository for application settings persistence.

This trait defines operations for storing and retrieving the application settings as a whole. The implementation handles serialization.

§Design Rules

  • No sqlx types in signatures
  • Works with domain Settings type directly
  • Implementation handles JSON serialization internally

Required Methods§

Source

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

Load application settings.

Returns default settings if none are stored.

Source

fn save<'life0, 'life1, 'async_trait>( &'life0 self, settings: &'life1 Settings, ) -> Pin<Box<dyn Future<Output = Result<(), RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Save application settings.

Implementors§