Skip to main content

LoadReport

Struct LoadReport 

Source
#[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
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional 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. orgn in 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

Source

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.

Source

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

Source§

fn clone(&self) -> LoadReport

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for LoadReport

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for LoadReport

Source§

fn default() -> LoadReport

Returns the “default value” for a type. Read more
Source§

impl Eq for LoadReport

Source§

impl PartialEq for LoadReport

Source§

fn eq(&self, other: &LoadReport) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for LoadReport

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.