pub fn parse(
file: Option<&PathBuf>,
schema: Option<MtreeSchema>,
) -> Result<Mtree, Error>
Expand description
Parse and interpret an MTREE file.
- Reads the contents of a file or stdin.
- Check whether the input is gzip compressed as that’s how it’s delivered inside of packages.
- Parse the input
NOTE: If a command is piped to this process, the input is read from stdin.
See IsTerminal
for more information about how terminal detection works.
§Errors
- Error::NoInputFile if a file is given and doesn’t exist.
- Error::IoPath if a given file cannot be opened or read.
- Error::Io if the file is streamed via StdIn and an error occurs.
- Error::InvalidGzip if the file is gzip compressed, but the archive is malformed.
- Error::InvalidUTF8 if the given file contains invalid UTF-8.
- Error::ParseError if a malformed MTREE file is encountered.
- Error::InterpreterError if expected properties for a given type aren’t set.