Skip to main content

validate_reader

Function validate_reader 

Source
pub fn validate_reader(
    reader: &Reader,
    path: &str,
    compression: &str,
    warnings: &[String],
) -> Result<ValidationReport, Error>
Expand description

Validation report types and comprehensive file checker. Run comprehensive validation on an already-opened Reader.

Checks header structure, file size, endianness, data statistics cross-check (1% tolerance), and NaN/Inf scanning. Avoids the redundant open that validate_full performs.

The warnings parameter accepts the permissive-mode warnings from Reader::open_permissive; pass an empty slice for strict-mode opens.

§Errors

Returns Err only when reading or computing statistics fails.

§Example

use mrc::Reader;
use mrc::validate_reader;

let reader = Reader::open("protein.mrc")?;
let report = validate_reader(&reader, "protein.mrc", "plain", &[])?;
println!("Is valid: {}", report.is_valid());