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

Method function_line

alpm-pkgbuild/src/bridge/parser.rs:638–655  ·  view source on GitHub ↗

Recognizes a [`RawPackageName`] in a string slice. # Errors Returns an error if no [`RawPackageName`] can be found in `input`.

(input: &mut &str)

Source from the content-addressed store, hash-verified

636 ///
637 /// Returns an error if no [`RawPackageName`] can be found in `input`.
638 fn function_line(input: &mut &str) -> ModalResult<RawPackageName> {
639 // Parse the start of the line.
640 //
641 // The start `FUNCTION` may backtrack. This indicates that the next section has been
642 // hit. **Everything else** will return a hard error, as it indicates invalid or
643 // unexpected bridge output.
644 ("FUNCTION").parse_next(input)?;
645 let package_name = RawPackageName::parser.parse_next(input)?;
646
647 cut_err((space0, alt((eof, "\n"))))
648 .context(StrContext::Label("character"))
649 .context(StrContext::Expected(StrContextValue::Description(
650 "end of line or end of file.",
651 )))
652 .parse_next(input)?;
653
654 Ok(package_name)
655 }
656}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected