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§
Sourcefn emit(&self, event: DownloadEvent)
fn emit(&self, event: DownloadEvent)
Emit a download event.
Implementations should handle the event asynchronously or buffer it. This method should not block.
Sourcefn clone_box(&self) -> Box<dyn DownloadEventEmitterPort>
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.