Expand description
A reference implementation of the LUMEN print file format, version 1.0.
LUMEN is the Open Resin Alliance’s resin (MSLA) print format; the normative
specification lives beside this crate, in spec/. This crate is a consumer
of that text, not a substitute for it: where the specification and this code
disagree, the specification wins, and the conformance corpus under
test-vectors/ is what settles the argument.
§Shape
container- the file header, chunk directory and trailer.chunks- one codec per chunk type.json- the typedMETA,PROFandLROVmodels.ree- run-end encoded layer masks: binary, grayscale and split.timing- the per-layer settings pipeline of section 8.crypto-AUTH, the AEAD units, Argon2id and X25519 key wrapping.validate- the checks of section 11, named as the corpus names them.reader-reader::LumenFile, including random access to one layer.writer-writer::Encoder, which produces a conforming file.
§Reading
use lumen::{reader::LumenFile, validate::Level};
let bytes = std::fs::read("print.lumen").unwrap();
let file = LumenFile::open(&bytes, Level::Loose).unwrap();
println!("{} layers", file.layer_count());
let layer = file.layer(0).unwrap();
println!("{:?}", layer.tag);§Two tiers
reader::LumenFile decodes what a caller asks for and nothing else: a
layer is fetched by index, which decompresses only the LAYR chunk that
holds it. A firmware reader can open the file, read META and the layer
table, and stream layers through a fixed-size buffer without ever
materializing the whole file. A slicer can instead use writer::Encoder,
which trains the zstd dictionary, frames the chunks and assembles the
directory.
Re-exports§
pub use check::Check;pub use container::ChunkDescriptor;pub use container::ChunkType;pub use container::Directory;pub use container::FileHeader;pub use error::Error;pub use error::Result;pub use json::Material;pub use json::Meta;pub use json::Profile;pub use json::Sector;pub use json::Timing;pub use reader::LumenFile;pub use ree::DecodedLayer;pub use ree::EncodeMode;pub use validate::Level;pub use validate::Validator;pub use writer::Encoder;
Modules§
- check
- The named conformance checks.
- chunks
- One codec per chunk type ([
spec/03-chunks.md], [spec/09-layer-data.md], [spec/10-scene-chunks.md]). - container
- The container: 32-byte file header, 32-byte chunk descriptors, the directory
at the end of the file, and the 8-byte trailer ([
spec/02-file-structure.md]). - crypto
- Authenticated encryption: the
AUTHchunk, the AEAD units, Argon2id password wrapping and X25519 machine binding ([spec/15-encryption.md]). - error
- The crate’s single error type, carrying the conformance check that failed.
- io
- Little-endian, bounds-checked byte reading and writing.
- json
- Typed models for the JSON chunks:
META(with itssectorsentries),PROFandLROV. - reader
- Reading a file:
LumenFile, including random access to one layer. - ree
- Run-end encoded layer masks ([
spec/11-layer-encoding.md] section 5). - timing
- The per-layer settings pipeline ([
spec/14-layer-timing.md] section 8). - validate
- The checks of [
spec/17-validation.md] section 11. - varint
- Protocol-Buffers-style varints ([
spec/11-layer-encoding.md] section 5.2). - writer
- Writing a file:
Encoder, which assembles a conforming.lumencontainer.