#[non_exhaustive]pub struct LoadReport {
pub retained: Vec<OpaqueChunk>,
pub dropped: Vec<[u8; 4]>,
pub inconsistency: Option<LayerInconsistency>,
}Expand description
What a load did beyond producing the Module — the visibility §8 demands,
so an editor can warn before a save-in-place silently drops data. Empty for
a file this build fully understands.
It is also what carries the §8 retention across a load/save: the danger of a
tolerant reader is not the reading, it is the saving, and the report is
produced at open time while the damage happens at save time. Nothing else
bridges the two, so the retained bytes live here — see Self::retained
and write_preserving.
#[non_exhaustive]: only read ever builds one, so forbidding the struct
literal downstream costs nothing and leaves room to grow.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.retained: Vec<OpaqueChunk>Ancillary chunks this build cannot reproduce from the module but may
copy verbatim into a rewritten file — byte 3 of the id is lowercase
(§2.1). Feed the report to write_preserving and they survive
untouched; call plain write() and they are gone.
Two kinds land here, and the second is easy to miss:
- chunks this build does not know — written by a later version;
- chunks it knows and parsed correctly but has nowhere to put,
because the model field is
#[cfg]-gated out.orgnin a build with no importer is the case that exists today.
Both fail the same way on a rewrite — the writer regenerates chunks from the model, and neither is in it — so both need the same carrying.
Kept in file order.
dropped: Vec<[u8; 4]>Unknown ancillary chunk ids this build must not copy: byte 3 of the id is uppercase, meaning the chunk may depend on data that just changed (§2.1). Their payload is deliberately not kept — re-emitting it would be worse than losing it. A rewrite loses these, and this list is the only warning anyone will get.
inconsistency: Option<LayerInconsistency>The first cross-chunk inconsistency in the assembled module, if any.
Each chunk validates on its own — framing, CBOR, every PcmRef against
the blob region — but a Clip naming a track that does not exist spans
two chunks, so nothing catches it on the way in. A .xmr is an
untrusted byte string like any other file, and handing back a module
that cannot be played without saying so is not tolerance, it is silence.
Reported rather than fatal: an editor opening a damaged project in order
to repair it needs the module, not an error. A consumer that will hand
the module straight to the player should treat this as a refusal — or
simply check Self::is_clean, which covers both halves.
Implementations§
Source§impl LoadReport
impl LoadReport
Sourcepub fn is_clean(&self) -> bool
pub fn is_clean(&self) -> bool
true when this build understood the file in full: no unknown chunk of
either kind, and the assembled module’s layers agree with each other.
Stricter than Self::rewrite_is_lossless on purpose — a retained
chunk survives a rewrite but this build still could not put it in the
module, and an editor showing “opened, with reservations” wants to know.
Sourcepub fn rewrite_is_lossless(&self) -> bool
pub fn rewrite_is_lossless(&self) -> bool
true when saving through write_preserving loses nothing: every
chunk this build could not put in the module was safe to copy and is
being carried.
This is the question an editor actually needs answered before a
save-in-place. false means the file holds something this build cannot
understand and is forbidden to copy — say so before overwriting the
only copy of it.
Trait Implementations§
Source§impl Clone for LoadReport
impl Clone for LoadReport
Source§fn clone(&self) -> LoadReport
fn clone(&self) -> LoadReport
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more