Files
craft-libs/crates/raw/examples/decode_report/main.rs
T
42e0bd5482 Add a craft-raw decoder comparison example (#2417)
* Add a craft-raw decoder comparison example

* Clean up RAW decoder report test fixtures

* craft-raw: say the report hashes decoded samples and which revisions build it

The digest covers RawImage::data, after any decoder linearization, so the
README now says "decoded samples" and explains that two stored codes that
map to the same value give the same digest.

The copy-into-an-older-checkout instructions now name the first main
revision the example builds on (ecee6933, #1171): older revisions have no
Cfa origin fields.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: FredApps <FredApps@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 05:50:06 +07:00

36 lines
1.3 KiB
Rust

//! Report the decoded samples and selected metadata of explicitly supplied RAW files.
//! `cargo run --locked -p craft-raw --example decode_report -- <file> [<file> ...]`
#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)]
#![forbid(unsafe_code)]
#[cfg(not(target_arch = "wasm32"))]
mod report;
#[cfg(not(target_arch = "wasm32"))]
fn main() -> std::process::ExitCode {
use std::io::{self, Write};
use std::process::ExitCode;
let stdout = io::stdout();
let mut out = stdout.lock();
match report::run(std::env::args_os().skip(1), &mut out, report::MAX_INPUT_BYTES, &craft_raw::Limits::default()) {
Ok(()) => ExitCode::SUCCESS,
Err(error) => {
let stderr = io::stderr();
let mut err = stderr.lock();
match error {
report::RunError::Usage => {
let _ = writeln!(err, "usage: decode_report <file> [<file> ...]");
}
report::RunError::Output(error) => {
let _ = writeln!(err, "decode_report: report output failed ({:?})", error.kind());
}
}
ExitCode::FAILURE
}
}
}
#[cfg(target_arch = "wasm32")]
fn main() {}