Skip to main content

Module validate

Module validate 

Source
Expand description

Validation gates of the image type-state pipeline.

The loader is a three-state automaton. Each state is a distinct private type, and the only way to move between them is the transition function that consumes the previous state by value:

RawBytes --validate_magic_bytes--> VerifiedPngFile
         --decode_png-------------> DecodedPng
         --validate_no_jpeg_artifacts--> ImageBuffer

Because the intermediate states are private to this module and ImageBuffer::new is pub(crate), no caller can fabricate a validated image or skip a gate: the ordering is enforced by the type system rather than by convention.

Structs§

ImageGeometry
Geometry of a candidate container, read from its header alone.

Enums§

ValidationError
Every way the validation pipeline can reject a candidate container image.

Functions§

load_and_validate
Loads a container image from disk and runs it through every validation gate.
probe_geometry
Reads the geometry of a container without decoding a single pixel.