MCPcopy Create free account
hub / github.com/archlinux/alpm / parse

Function parse

alpm-srcinfo/src/commands.rs:164–177  ·  view source on GitHub ↗

Parses and interprets a SRCINFO file from a path or stdin. ## 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. [`IsTerminal`]: https://doc.rust-lang.org/stable/std/io/trait.IsTerminal.html # Errors Returns an error if the input can not be parsed and validated, or if the output can not be forma

(
    file: Option<&PathBuf>,
    schema: Option<SourceInfoSchema>,
)

Source from the content-addressed store, hash-verified

162/// Furthermore, returns an error array with potentially un/-recoverable (linting-)errors, which
163/// needs to be explicitly handled by the caller.
164pub fn parse(
165 file: Option<&PathBuf>,
166 schema: Option<SourceInfoSchema>,
167) -> Result<SourceInfo, Error> {
168 let source_info = if let Some(file) = file {
169 SourceInfo::from_file_with_schema(file, schema)?
170 } else if !io::stdin().is_terminal() {
171 SourceInfo::from_stdin_with_schema(schema)?
172 } else {
173 Err(Error::NoInputFile)?
174 };
175
176 Ok(source_info)
177}

Callers 6

mainFunction · 0.70
validateFunction · 0.70
format_source_infoFunction · 0.70
format_packagesFunction · 0.70
mainFunction · 0.50
extract_elf_sonamesFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected