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

Function container_open_name

atomic-canonical/src/memory.rs:201–212  ·  view source on GitHub ↗

If `line` opens a container directive (`:::name` optionally with `{...}`), return the directive name. A bare `:::` (a close) yields `None`.

(line: &str)

Source from the content-addressed store, hash-verified

199/// If `line` opens a container directive (`:::name` optionally with `{...}`),
200/// return the directive name. A bare `:::` (a close) yields `None`.
201fn container_open_name(line: &str) -> Option<&str> {
202 let rest = line.strip_prefix(":::")?;
203 let end = rest
204 .find(|c: char| c == '{' || c.is_whitespace())
205 .unwrap_or(rest.len());
206 let name = &rest[..end];
207 if name.is_empty() {
208 None
209 } else {
210 Some(name)
211 }
212}
213
214/// Wrap a local id into `urn:atomic:memory:<local>` unless already a urn.
215fn as_memory_urn(local: &str) -> String {

Callers 1

extract_memory_containerFunction · 0.85

Calls 3

is_whitespaceMethod · 0.45
lenMethod · 0.45
is_emptyMethod · 0.45

Tested by

no test coverage detected