MCPcopy Create free account
hub / github.com/base/base / parse

Method parse

acceptance/src/publish.rs:72–80  ·  view source on GitHub ↗

Reads only the exact metadata prefix of an owned comment.

(body: &str)

Source from the content-addressed store, hash-verified

70
71 /// Reads only the exact metadata prefix of an owned comment.
72 pub fn parse(body: &str) -> Result<Self> {
73 let encoded = body
74 .strip_prefix(&format!("{MARKER}\n{META_PREFIX}"))
75 .and_then(|tail| tail.split_once(" -->").map(|(metadata, _)| metadata))
76 .ok_or_else(|| eyre::eyre!("owned marker has invalid metadata"))?;
77 let metadata: Self = serde_json::from_str(encoded)?;
78 metadata.validate()?;
79 Ok(metadata)
80 }
81}
82
83/// `GitHub` comment publisher with bounded requests and narrow comment ownership.

Callers 1

Calls 1

validateMethod · 0.45

Tested by

no test coverage detected