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

Method path

atomic-core/src/change/format_v3/graph_fields/encode.rs:32–49  ·  view source on GitHub ↗
(&mut self, path: &str)

Source from the content-addressed store, hash-verified

30 self.n(role + 1, p.pos.into());
31 }
32 fn path(&mut self, path: &str) -> FormatResult<()> {
33 charge(&mut self.budget, path.len(), 1)?;
34 let id = if let Some(&id) = self.paths.get(path) {
35 id
36 } else {
37 if self.dictionary.len() >= 1_000_000 {
38 return Err(FormatError::GraphFieldLimitExceeded);
39 }
40 charge(&mut self.budget, 1, 128)?;
41 charge(&mut self.budget, path.len(), 2)?;
42 let id = self.dictionary.len() as u32;
43 self.dictionary.push(path.into());
44 self.paths.insert(path.into(), id);
45 id
46 };
47 self.n(PATH, id.into());
48 Ok(())
49 }
50 fn local(&mut self, role: usize, local: &Local) -> FormatResult<()> {
51 self.path(&local.path)?;
52 self.n(LOCAL + role, local.line);

Callers 2

localMethod · 0.45
opMethod · 0.45

Calls 6

chargeFunction · 0.70
getMethod · 0.65
lenMethod · 0.45
pushMethod · 0.45
insertMethod · 0.45
nMethod · 0.45

Tested by

no test coverage detected