DownloadEventEmitterPort

Trait DownloadEventEmitterPort 

Source
pub trait DownloadEventEmitterPort: Send + Sync {
    // Required methods
    fn emit(&self, event: DownloadEvent);
    fn clone_box(&self) -> Box<dyn DownloadEventEmitterPort>;
}
Expand description

Port for emitting download events.

This trait abstracts away the transport mechanism for download events. Implementations handle the actual event delivery (channels, SSE, Tauri events).

§Example

// In download manager
fn on_progress(&self, emitter: &dyn DownloadEventEmitterPort) {
    emitter.emit(DownloadEvent::DownloadProgress { ... });
}

Required Methods§

Source

fn emit(&self, event: DownloadEvent)

Emit a download event.

Implementations should handle the event asynchronously or buffer it. This method should not block.

Source

fn clone_box(&self) -> Box<dyn DownloadEventEmitterPort>

Clone this emitter into a boxed trait object.

This enables cloning of Arc<dyn DownloadEventEmitterPort> without requiring the underlying type to implement Clone.

Implementors§