Skip to main content

FlashKraft

Struct FlashKraft 

Source
pub struct FlashKraft {
Show 21 fields pub selected_image: Option<ImageInfo>, pub selected_target: Option<DriveInfo>, pub available_drives: Vec<DriveInfo>, pub flash_progress: Option<f32>, pub flash_bytes_written: u64, pub flash_speed_mb_s: f32, pub flash_stage: String, pub verify_progress: Option<f32>, pub verify_speed_mb_s: f32, pub verify_phase: &'static str, pub error_message: Option<String>, pub device_selection_open: bool, pub flashing_active: bool, pub flash_complete: bool, pub flash_cancel_token: Arc<AtomicBool>, pub flash_run_id: u64, pub theme: Theme, pub storage: Option<Storage>, pub animated_progress: AnimatedProgress, pub verify_animated_progress: AnimatedProgress, pub animation_time: f32,
}
Expand description

The main application state

This struct represents the complete state of the FlashKraft application. All state is managed immutably and changes only through the update function.

Fields§

§selected_image: Option<ImageInfo>

Currently selected image file

§selected_target: Option<DriveInfo>

Currently selected target drive

§available_drives: Vec<DriveInfo>

List of available drives detected on the system

§flash_progress: Option<f32>

Current flash progress (0.0 to 1.0), None if not flashing

§flash_bytes_written: u64

Bytes written during flash operation

§flash_speed_mb_s: f32

Current transfer speed in MB/s

§flash_stage: String

Current pipeline stage label (e.g. “Writing image to device…”, “Verifying written data…”)

§verify_progress: Option<f32>

Verification overall progress (0.0–1.0 across both image-hash and device read-back passes). None when verification has not started yet.

§verify_speed_mb_s: f32

Current verification read speed in MB/s (0.0 when not verifying).

§verify_phase: &'static str

Which verification pass is active: "image" or "device". Empty when not verifying.

§error_message: Option<String>

Error message if an error occurred

§device_selection_open: bool

Whether the device selection view is currently open

§flashing_active: bool

Whether a flash operation is currently active (for subscription). Remains true through the entire pipeline including verification — only set to false when FlashCompleted arrives.

§flash_complete: bool

Set to true when FlashCompleted(Ok(())) arrives. Distinct from flashing_active so the view can show the complete screen without killing the subscription prematurely.

§flash_cancel_token: Arc<AtomicBool>

Cancellation token for flash operation

§flash_run_id: u64

Monotonically increasing counter incremented on every new flash attempt. Included in the subscription ID hash so that flashing the same image to the same device a second time always creates a fresh subscription instead of reusing the completed (pending) one from the previous run.

§theme: Theme

Currently selected theme

§storage: Option<Storage>

Storage for persistent preferences

§animated_progress: AnimatedProgress

Animated progress bar for flash operations

§verify_animated_progress: AnimatedProgress

Separate green animated progress bar shown during verification.

§animation_time: f32

Animation time for progress line glow effects (0.0 to infinity)

Implementations§

Source§

impl FlashKraft

Source

pub fn new() -> Self

Create a new FlashKraft instance with default values

Source

pub fn is_ready_to_flash(&self) -> bool

Check if the application is ready to flash

Returns true if both an image and target are selected

Source

pub fn is_flashing(&self) -> bool

Check if a flash operation is currently in progress

Source

pub fn is_flash_complete(&self) -> bool

Check if the flash operation is complete (pipeline finished successfully).

Source

pub fn has_error(&self) -> bool

Check if there is an error

Source

pub fn reset(&mut self)

Reset the application state

Source

pub fn cancel_selections(&mut self)

Cancel current selections

Source

pub fn begin_flash_state(&mut self)

Prepare state for a new flash attempt.

Source§

impl FlashKraft

Source

pub fn update(&mut self, message: Message) -> Task<Message>

Update the application state based on a message

This is the core of The Elm Architecture. All state changes flow through this function.

§Arguments
  • message - The message to process
§Returns

A Task that may trigger async operations, or Task::none()

Source

pub fn view(&self) -> Element<'_, Message>

Render the user interface

This is a pure function that describes what the UI should look like based on the current state.

§Returns

An Element describing the UI to render

Source

pub fn subscription(&self) -> Subscription<Message>

Subscribe to long-running operations

This enables streaming progress updates from the flash operation, animation ticks for the progress bar, and automatic USB hotplug detection (so the drive list updates without the user pressing Refresh).

§Returns

A Subscription that emits messages for ongoing operations

Trait Implementations§

Source§

impl Debug for FlashKraft

Source§

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

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

impl Default for FlashKraft

Source§

fn default() -> Self

Returns the “default value” for a type. 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> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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<State, Message> IntoBoot<State, Message> for State

Source§

fn into_boot(self) -> (State, Task<Message>)

Turns some type into the initial state of some Application.
Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> MaybeClone for T

Source§

impl<T> MaybeDebug for T

Source§

impl<T> MaybeSend for T
where T: Send,

Source§

impl<T> NoneValue for T
where T: Default,

Source§

type NoneType = T

Source§

fn null_value() -> T

The none-equivalent value.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more