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

Method as_slice

atomic-canonical/src/node.rs:126–133  ·  view source on GitHub ↗

The criteria as a slice, whatever the shape on disk. Callers use this instead of matching, so the legacy variant stays invisible to them.

(&self)

Source from the content-addressed store, hash-verified

124 /// The criteria as a slice, whatever the shape on disk. Callers use this
125 /// instead of matching, so the legacy variant stays invisible to them.
126 pub fn as_slice(&self) -> &[String] {
127 match self {
128 // `from_ref` lets a scalar masquerade as a one-element slice without
129 // allocating — and, crucially, without rewriting the stored form.
130 Self::One(one) => std::slice::from_ref(one),
131 Self::Many(many) => many,
132 }
133 }
134
135 /// True when no criteria are referenced. Drives `skip_serializing_if`, so an
136 /// empty list is omitted exactly as it was under the plain `Vec`.

Callers 15

attached_non_utf8_valueFunction · 0.45
write_commitMethod · 0.45
validate_intentFunction · 0.45
is_emptyMethod · 0.45
layer_from_dirFunction · 0.45
layer_from_entriesFunction · 0.45
import_v3_bytesMethod · 0.45
stageMethod · 0.45
write_import_recordedMethod · 0.45

Calls

no outgoing calls