MCPcopy Create free account
hub / github.com/It4innovations/hyperqueue / parse_resource_name

Function parse_resource_name

crates/hyperqueue/src/worker/parser.rs:177–190  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

175}
176
177fn parse_resource_name() -> impl CharParser<String> {
178 let identifier = filter(|&c| is_valid_starting_resource_char(c))
179 .map(Some)
180 .chain::<char, Vec<char>, _>(filter(|&c| is_valid_resource_char(c)).repeated())
181 .collect::<String>();
182
183 identifier.map_err_with_span(|error: ParseError, span| {
184 error.merge(ParseError::expected_input_found_string(
185 span,
186 Some(Some("identifier".to_string())),
187 None,
188 ))
189 })
190}
191
192/// Parses a resource definition, which consists of a name and a resource kind.
193/// Example: `mem=list(1,2)`, `disk=sum(10)`, `foo=range(1-2)`.

Callers 1

Calls 4

is_valid_resource_charFunction · 0.85
mergeMethod · 0.80
to_stringMethod · 0.80

Tested by

no test coverage detected