Skip to main content

Crate utf8_forge

Crate utf8_forge 

Source
Expand description

utf8-forge orchestration: per-file pipelines, report assembly, and the run() entry point with exit-code mapping.

Exit codes (docs/USAGE.md §7):

  • 0 success
  • 1 non-fatal per-file issues (unknown, decode_error, io_error, fetch_error)
  • 2 fatal (bad args, missing root, I/O setup failure) — also emitted by clap on parse errors
  • 3 verify found non-UTF-8 whitelisted files

Modules§

cli
clap definitions for the CLI surface (DESIGN.md §9).
detector
Encoding detection (frozen rule-based algorithm, DESIGN.md §3).
error
Error types shared across the transcoding pipeline.
fetcher
Optional remote download (DESIGN.md §8).
filter
File selection: extension whitelist + directory blacklist double gate (DESIGN.md §5).
reporter
Console output + JSON reports (DESIGN.md §9, EXECUTION.md §12).
transcoder
Strict decode / encode / transcode (DESIGN.md §4).
walker
Recursive candidate collection on top of walkdir (DESIGN.md §6).
writer
Crash-safe persistence (DESIGN.md §7).

Structs§

ConvertCtx
Shared context for tree-mode conversion.

Functions§

convert_file
Detect + transcode + (unless dry-run) backup + atomic write.
run
Dispatch a parsed CLI and map the outcome to a process exit code. Fatal setup errors print to stderr and yield exit code 2.
scan_file
Detect only. Oversized files are never read.
verify_file
Verify a file is UTF-8 without BOM. Unreadable / oversized files fail closed (a gate must not wave through what it cannot inspect).