MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / parse_qualified

Function parse_qualified

atomic-core/src/kg/iri.rs:89–100  ·  view source on GitHub ↗
(iri: &'a str, kind: &str)

Source from the content-addressed store, hash-verified

87}
88
89fn parse_qualified<'a>(iri: &'a str, kind: &str) -> Result<(ProjectId, &'a str), IriError> {
90 let rest = iri
91 .strip_prefix("urn:atomic:project:")
92 .ok_or_else(|| IriError(iri.into()))?;
93 let (project, rest) = rest.split_once(':').ok_or_else(|| IriError(iri.into()))?;
94 let project = ProjectId::from_base32(project).map_err(|_| IriError(iri.into()))?;
95 let rest = rest
96 .strip_prefix(kind)
97 .and_then(|s| s.strip_prefix(':'))
98 .ok_or_else(|| IriError(iri.into()))?;
99 Ok((project, rest))
100}
101
102macro_rules! named {
103 ($mint:ident, $parse:ident, $kind:literal, $path:literal) => {

Callers 3

parse_intentFunction · 0.85
parse_childFunction · 0.85
parse_findingFunction · 0.85

Calls 1

IriErrorClass · 0.85

Tested by

no test coverage detected