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

Method parser

alpm-srcinfo/src/pkgbuild_bridge/package.rs:132–143  ·  view source on GitHub ↗

Recognizes any of the [`PackageKeyword`] in an input string slice. Does not consume input and stops after any keyword matches. # Errors Returns an error, if an unknown keyword is encountered.

(input: &mut &str)

Source from the content-addressed store, hash-verified

130 pub fn parser<'a>(input: &mut Input<'a>) -> PResult<'a, PackageKeyword> {
131 cut_err(alt((
132 RelationKeyword::parser.map(PackageKeyword::Relation),
133 SharedMetaKeyword::parser.map(PackageKeyword::SharedMeta),
134 )))
135 .expected_strings(
136 [RelationKeyword::VARIANTS, SharedMetaKeyword::VARIANTS]
137 .into_iter()
138 .flatten(),
139 )
140 .layer("package base property keyword")
141 .parse_next(input)
142 }
143}
144
145/// Ensures that in a combination of [`Keyword`] and [`ClearableValue`], a
146/// [`ClearableValue::Single`] is used and returns the value.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected