DownloadEvent

Enum DownloadEvent 

Source
pub enum DownloadEvent {
    QueueSnapshot {
        items: Vec<DownloadSummary>,
        max_size: u32,
    },
    DownloadStarted {
        id: String,
    },
    DownloadProgress {
        id: String,
        downloaded: u64,
        total: u64,
        speed_bps: f64,
        eta_seconds: f64,
        percentage: f64,
    },
    ShardProgress {
        id: String,
        shard_index: u32,
        total_shards: u32,
        shard_filename: String,
        shard_downloaded: u64,
        shard_total: u64,
        aggregate_downloaded: u64,
        aggregate_total: u64,
        speed_bps: f64,
        eta_seconds: f64,
        percentage: f64,
    },
    DownloadCompleted {
        id: String,
        message: Option<String>,
    },
    DownloadFailed {
        id: String,
        error: String,
    },
    DownloadCancelled {
        id: String,
    },
    QueueRunComplete {
        summary: QueueRunSummary,
    },
}
Expand description

Single discriminated union for all download events.

The frontend handles this as a TypeScript discriminated union:

type DownloadEvent =
  | { type: "queue_snapshot"; items: DownloadSummary[]; max_size: number }
  | { type: "download_started"; id: string }
  | { type: "download_progress"; id: string; downloaded: number; total: number; ... }
  | { type: "shard_progress"; id: string; shard_index: number; ... }
  | { type: "download_completed"; id: string }
  | { type: "download_failed"; id: string; error: string }
  | { type: "download_cancelled"; id: string };

Variants§

§

QueueSnapshot

Snapshot of the entire queue state.

Fields

§items: Vec<DownloadSummary>

All items currently in the queue.

§max_size: u32

Maximum queue capacity.

§

DownloadStarted

A download has started.

Fields

§id: String

Canonical ID of the download.

§

DownloadProgress

Progress update for a non-sharded download.

Fields

§id: String

Canonical ID of the download.

§downloaded: u64

Bytes downloaded so far.

§total: u64

Total bytes to download.

§speed_bps: f64

Current download speed in bytes per second.

§eta_seconds: f64

Estimated time remaining in seconds.

§percentage: f64

Progress percentage (0.0 - 100.0).

§

ShardProgress

Progress update for a sharded download.

Fields

§id: String

Canonical ID of the download (group ID).

§shard_index: u32

Current shard index (0-based).

§total_shards: u32

Total number of shards.

§shard_filename: String

Filename of the current shard.

§shard_downloaded: u64

Bytes downloaded for current shard.

§shard_total: u64

Total bytes for current shard.

§aggregate_downloaded: u64

Aggregate bytes downloaded across all shards.

§aggregate_total: u64

Aggregate total bytes across all shards.

§speed_bps: f64

Current download speed in bytes per second.

§eta_seconds: f64

Estimated time remaining in seconds.

§percentage: f64

Aggregate progress percentage (0.0 - 100.0).

§

DownloadCompleted

Download completed successfully.

Fields

§id: String

Canonical ID of the download.

§message: Option<String>

Optional success message.

§

DownloadFailed

Download failed with an error.

Fields

§id: String

Canonical ID of the download.

§error: String

Error message describing what went wrong.

§

DownloadCancelled

Download was cancelled by the user.

Fields

§id: String

Canonical ID of the download.

§

QueueRunComplete

Queue run completed (all downloads in the queue finished).

Emitted when the download queue transitions from busy → idle, providing a complete summary of all artifacts that were processed during the run.

Fields

§summary: QueueRunSummary

Complete summary of the queue run.

Implementations§

Source§

impl DownloadEvent

Source

pub const fn queue_snapshot(items: Vec<DownloadSummary>, max_size: u32) -> Self

Create a queue snapshot event.

Source

pub fn started(id: impl Into<String>) -> Self

Create a download started event.

Source

pub fn progress( id: impl Into<String>, downloaded: u64, total: u64, speed_bps: f64, ) -> Self

Create a non-sharded progress event.

Source

pub fn shard_progress( id: impl Into<String>, shard_index: u32, total_shards: u32, shard_filename: impl Into<String>, shard_downloaded: u64, shard_total: u64, aggregate_downloaded: u64, aggregate_total: u64, speed_bps: f64, ) -> Self

Create a sharded progress event.

Source

pub fn completed( id: impl Into<String>, message: Option<impl Into<String>>, ) -> Self

Create a download completed event.

Source

pub fn failed(id: impl Into<String>, error: impl Into<String>) -> Self

Create a download failed event.

Source

pub fn cancelled(id: impl Into<String>) -> Self

Create a download cancelled event.

Source

pub const fn queue_run_complete(summary: QueueRunSummary) -> Self

Create a queue run complete event.

Source

pub fn id(&self) -> Option<&str>

Get the download ID from any event type.

Source

pub const fn event_name(&self) -> &'static str

Get the event name for wire protocols.

This provides consistent event naming for Tauri and SSE transports. Note: Both ShardProgress and DownloadProgress use “download:progress” as the channel name; differentiation happens via the type discriminator.

Trait Implementations§

Source§

impl Clone for DownloadEvent

Source§

fn clone(&self) -> DownloadEvent

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DownloadEvent

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for DownloadEvent

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for DownloadEvent

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,