Skip to main content

metadata_of

Function metadata_of 

Source
pub fn metadata_of<R: Read + Seek>(reader: R) -> Result<DocumentMut>
Expand description

The metadata document of a byte stream, asking no conformance question.

Reads the member SPEC 2.1 names and parses it, requiring of that member what SPEC 2.2 requires: one of it, valid TOML, UTF-8. It looks for neither required key and never locates a payload.

This exists because a container can be non-conformant somewhere else entirely and still carry a metadata document worth reading: payload.file naming no member, naming several, or naming something SPEC 2.3 forbids all leave a document that parsed cleanly, and Container::read returns an error over the payload before a caller can reach it. A program showing a person what is in a file wants to show them that document.

It is not a verdict and must not be used as one: a document coming back says nothing about whether the container conforms. Ask validate for that, which is the only function here that answers the question SPEC 3 constrains.