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

Method strip_prefix

crates/common/src/env.rs:204–214  ·  view source on GitHub ↗

Strip a prefix from this name, returning the suffix components.

(&self, prefix: &Name)

Source from the content-addressed store, hash-verified

202
203 /// Strip a prefix from this name, returning the suffix components.
204 pub fn strip_prefix(&self, prefix: &Name) -> Option<Vec<NameComponent>> {
205 let self_components = self.components();
206 let prefix_components = prefix.components();
207 if self_components.len() < prefix_components.len() {
208 return None;
209 }
210 if self_components[..prefix_components.len()] != prefix_components[..] {
211 return None;
212 }
213 Some(self_components[prefix_components.len()..].to_vec())
214 }
215
216 /// Append suffix components to this name.
217 pub fn append_components(&self, suffix: &[NameComponent]) -> Name {

Callers 8

generate_aux_patchesFunction · 0.80
aux_rec_suffix_idxFunction · 0.80
build_below_indc_ctorFunction · 0.80
build_rec_typeFunction · 0.80
get_minor_nameFunction · 0.80
name_replace_prefixFunction · 0.80
system_ram_gibFunction · 0.80
current_rss_mibFunction · 0.80

Calls 2

componentsMethod · 0.80
lenMethod · 0.45

Tested by

no test coverage detected