Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

GUI Application

The project includes a native desktop GUI built with egui/eframe, an immediate-mode GUI framework for Rust.

Launch

cargo run --bin convert_to_parquet_gui

The gui Cargo feature (enabling eframe, rfd, egui_extras) is a default feature, so a plain build/run enables it; on a build with --no-default-features, pass --features gui explicitly. The binary is declared in Cargo.toml as convert_to_parquet_gui, with its entry point at src/bin/gui_convert.rs; the GUI modules live under src/gui/.

Features

FeatureDescription
File drag-and-dropDrag input files onto the window, or use the file/folder picker (rfd)
Schema editingInspect and modify inferred column types/names before conversion
Column renaming (Parquet)For Parquet inputs, rename columns in place via parquet_rewrite::rename_parquet_columns
Data previewView a sample of the data before committing to conversion
JSON flatten optionsToggle --flatten / separator / max-level per file, same as the CLI
Batch conversionQueue multiple files and convert them in one operation, capped by memory-aware concurrency (memory::max_concurrent_jobs)
Overwrite guardsWarns when an output file already exists; lets you confirm
Export format selectionChoose output format(s): Parquet, CSV, JSONL, JSON, and/or XLSX (multiple at once)

Architecture

The GUI follows a model-view separation pattern:

┌────────────────────────────────────────────────────────────┐
│                convert_to_parquet_gui                      │
│  src/bin/gui_convert.rs (entry point → gui::run())         │
├────────────────────────────────────────────────────────────┤
│  src/gui/                                                  │
│  ├── mod.rs      ── Module wiring                          │
│  ├── app.rs      ── ConverterApp state, egui App impl      │
│  ├── model.rs    ── UI state types (FileOptions,           │
│  │                  OutputSelection, EditableField, ...)   │
│  ├── worker.rs   ── Background analysis/conversion         │
│  │                  threads (mpsc channel)                 │
│  ├── analysis.rs ── Input format detection                 │
│  ├── paths.rs    ── Output path resolution                 │
│  ├── theme.rs    ── egui theme setup                       │
│  └── view/                                                 │
│      ├── mod.rs     ── Menu bar, sidebar, outputs panel,   │
│      │                 overwrite modal                     │
│      ├── detail.rs  ── Per-file detail tabs (data/schema/  │
│      │                 options/validation/parquet stats)   │
│      └── preview.rs ── Data preview tab rendering          │
└────────────────────────────────────────────────────────────┘

Model-View Separation

  • Model (model.rs): data structures holding UI state — loaded files (FileEntry), per-file options (FileOptions, column edits), requested outputs (OutputSelection), job state (JobState).
  • View (view/): panels render the model and push UiActions back to app.rs, which mutates state and forwards work to worker.rs.

Background Worker Threads

Long-running analysis and conversions run on background worker threads (src/gui/worker.rs) to keep the UI responsive:

  1. Each queued file is analyzed (spawn_analysis) and, once started, converted (spawn_conversion) on its own std::thread::spawn thread.
  2. Concurrency is capped at memory::max_concurrent_jobs() (memory-budget-aware); queued jobs beyond the cap wait in JobState::Queued until a slot frees up.
  3. Workers send WorkerMsg (Analyzed, Progress, ProgressBytes, Done, Failed) back to the UI thread through an mpsc channel.
  4. The UI polls the channel each frame and updates per-file progress and results.

This design prevents the UI from freezing during large file conversions and bounds total memory use across concurrent jobs.

Usage Walkthrough

  1. Launch the application with cargo run --bin convert_to_parquet_gui
  2. Add files by dragging them onto the window or using the file picker
  3. Review schema for each file — adjust column types if needed
  4. Select output format from the drop-down (Parquet, CSV, JSONL, JSON, XLSX)
  5. Set output directory and confirm overwrite behaviour
  6. Click Convert — progress bars show per-file status
  7. View results in the results panel after completion

Key Source Files

FilePurpose
src/bin/gui_convert.rsEntry point for the convert_to_parquet_gui binary
src/gui/app.rsConverterApp state, egui App trait implementation, job scheduling
src/gui/model.rsUI state types: FileOptions, OutputSelection, EditableField, JobState, DetailTab
src/gui/worker.rsBackground analysis/conversion threads, WorkerMsg channel
src/gui/analysis.rsInput format detection for a dropped/picked file
src/gui/paths.rsOutput path resolution (per-file and per-sheet)
src/gui/theme.rsegui visual theme setup
src/gui/view/mod.rsMenu bar, sidebar, output-format panel, overwrite confirmation modal
src/gui/view/detail.rsPer-file detail tabs: data preview, schema editor, options, validation, Parquet stats
src/gui/view/preview.rsTabular data preview rendering