pub enum FlashUpdate {
Progress {
progress: f32,
bytes_written: u64,
speed_mb_s: f32,
},
VerifyProgress {
phase: &'static str,
overall: f32,
bytes_read: u64,
total_bytes: u64,
speed_mb_s: f32,
},
Message(String),
Completed,
Failed(String),
}Expand description
A normalised progress event suitable for consumption by any frontend (Iced GUI, Ratatui TUI, or future integrations).
Both the GUI’s FlashProgress and the TUI’s FlashEvent wrapper types
were independently duplicating this shape. By defining it once in core
and converting from FlashEvent via From, each frontend only needs
to bridge this into its own message/command type.
Key differences from the raw FlashEvent:
Progresscarries a normalised0.0–1.0write fraction (the raw event only carries raw byte counts; the fraction is computed here).VerifyProgresscarries a pre-computedoverallspanning both passes (viaverify_overall_progress) so frontends never need to duplicate that formula.StageandLogare both collapsed intoMessage(String)since both frontends treat them as human-readable status text.Done/ErrorbecomeCompleted/Failedto match conventional naming in UI code.
Variants§
Progress
Write progress.
progress is bytes_written / total_bytes clamped to [0.0, 1.0].
VerifyProgress
Verification read-back progress spanning both passes.
overall is in [0.0, 1.0]:
- image pass →
[0.0, 0.5] - device pass →
[0.5, 1.0]
Message(String)
Human-readable status text (stage label or log line).
Completed
The flash pipeline finished successfully.
Failed(String)
The flash pipeline failed; the string is a human-readable error.
Trait Implementations§
Source§impl Clone for FlashUpdate
impl Clone for FlashUpdate
Source§fn clone(&self) -> FlashUpdate
fn clone(&self) -> FlashUpdate
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for FlashUpdate
impl Debug for FlashUpdate
Source§impl From<FlashEvent> for FlashUpdate
impl From<FlashEvent> for FlashUpdate
Source§fn from(event: FlashEvent) -> Self
fn from(event: FlashEvent) -> Self
Convert a raw pipeline FlashEvent into a FlashUpdate.
Progressraw byte counts → normalised0.0–1.0fraction.VerifyProgressper-pass fraction → overall0.0–1.0viaverify_overall_progress.Stagedisplay string andLogstring →Message.Done→Completed,Error→Failed.