Skip to main content

Module run

Module run 

Source
Expand description

CLI dispatch logic for the readstat binary.

StructsΒ§

IndicatifProgress πŸ”’
ProgressCallback implementation backed by an indicatif::ProgressBar.
ReaderConfig πŸ”’
Inputs to the reader thread spawned by run_data.
WriteContext πŸ”’
State shared by every write strategy in run_data.

ConstantsΒ§

CHANNEL_CAPACITY πŸ”’
Capacity of the bounded channel between reader and writer threads. Also used as the batch size for bounded-batch parallel writes.
STREAM_ROWS πŸ”’
Default number of rows to read per streaming chunk.

FunctionsΒ§

create_progress πŸ”’
Create a progress bar if progress is enabled.
format_with_commas πŸ”’
Formats a number with comma thousands separators (e.g. 1081 -> β€œ1,081”).
join_reader πŸ”’
Joins the reader thread, surfacing either its internal error or a panic.
print_write_summary πŸ”’
Prints the β€œwrote N rows” summary. The library no longer prints this; the CLI owns all user-facing output.
resolve_columns πŸ”’
Resolve column names from --columns or --columns-file CLI options.
resolve_stream_rows πŸ”’
Determine stream row count based on reader type.
run
Executes the CLI command specified by the parsed ReadStatCli arguments.
run_data πŸ”’
Handle the data subcommand: read SAS data and write to an output file.
run_metadata πŸ”’
Handle the metadata subcommand: read and display SAS file metadata.
run_preview πŸ”’
Handle the preview subcommand: read a limited number of rows and write to stdout as CSV.
spawn_reader πŸ”’
Spawns the reader thread that parses row chunks and sends them to sender.
write_empty_output πŸ”’
Writes a valid empty output file (header-only CSV, empty Parquet/Feather/ NDJSON) when the input contributed zero rows. Without this, a zero-row input would produce no output file at all despite a success exit code.
write_parallel_parquet πŸ”’
Parallel Parquet write path (only for --parallel --parallel-write with Parquet output): write each buffered batch group to a temp file concurrently, then merge the temp files into the final output.
write_sequential πŸ”’
Default write path: consume chunks in order, streaming each to the format writer, then finalize. Memory stays bounded because only the most recent chunk is retained β€” kept solely so finish can report the row total.