pub struct AmpConfigPersistenceService { /* private fields */ }Expand description
Application service coordinating amplifier configuration persistence.
Command handlers should depend on this service rather than on a repository directly. That keeps infrastructure details out of the command layer and provides one place to centralize snapshot-related behavior.
Implementations§
Source§impl AmpConfigPersistenceService
impl AmpConfigPersistenceService
Sourcepub fn new(repository: Box<dyn AmpConfigPersistence>) -> Self
pub fn new(repository: Box<dyn AmpConfigPersistence>) -> Self
Creates the service with the chosen persistence backend.
Sourcepub fn load_amp_config(&self) -> Result<Option<AmpConfigDto>, String>
pub fn load_amp_config(&self) -> Result<Option<AmpConfigDto>, String>
Loads the last persisted amplifier configuration, if any.
Sourcepub fn persist_from_audio_service(
&self,
audio_service: &AudioService,
) -> Result<(), String>
pub fn persist_from_audio_service( &self, audio_service: &AudioService, ) -> Result<(), String>
Captures a snapshot from the current AudioService state and enqueues it for persistence.
This is the primary method used by mutating Tauri commands after they successfully update amplifier state. Disk I/O is executed by a background worker thread so command handlers return quickly.
Sourcepub fn persist_snapshot(&self, snapshot: AmpConfigDto) -> Result<(), String>
pub fn persist_snapshot(&self, snapshot: AmpConfigDto) -> Result<(), String>
Enqueues a precomputed snapshot for asynchronous persistence.
Auto Trait Implementations§
impl Freeze for AmpConfigPersistenceService
impl !RefUnwindSafe for AmpConfigPersistenceService
impl Send for AmpConfigPersistenceService
impl Sync for AmpConfigPersistenceService
impl Unpin for AmpConfigPersistenceService
impl UnsafeUnpin for AmpConfigPersistenceService
impl !UnwindSafe for AmpConfigPersistenceService
Blanket Implementations§
§impl<T> AnySync for T
impl<T> AnySync for T
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