MCPcopy Create free account
hub / github.com/argumentcomputer/ix / components

Method components

crates/common/src/env.rs:183–201  ·  view source on GitHub ↗

Decompose this name into its components (from root to leaf).

(&self)

Source from the content-addressed store, hash-verified

181 }
182 /// Decompose this name into its components (from root to leaf).
183 pub fn components(&self) -> Vec<NameComponent> {
184 let mut components = Vec::new();
185 let mut current = self;
186 loop {
187 match current.as_data() {
188 NameData::Anonymous(_) => break,
189 NameData::Str(pre, s, _) => {
190 components.push(NameComponent::Str(s.clone()));
191 current = pre;
192 },
193 NameData::Num(pre, n, _) => {
194 components.push(NameComponent::Num(n.clone()));
195 current = pre;
196 },
197 }
198 }
199 components.reverse();
200 components
201 }
202
203 /// Strip a prefix from this name, returning the suffix components.
204 pub fn strip_prefix(&self, prefix: &Name) -> Option<Vec<NameComponent>> {

Callers 3

generate_aux_patchesFunction · 0.80
build_below_indc_ctorFunction · 0.80
strip_prefixMethod · 0.80

Calls 3

as_dataMethod · 0.80
pushMethod · 0.80
cloneMethod · 0.45

Tested by

no test coverage detected