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

Function leaves

atomic-core/examples/semantic_codec_lab/control.rs:45–65  ·  view source on GitHub ↗
(
    values: &mut impl Values,
    limit: usize,
    visit: &mut impl FnMut(bool, u64, u64) -> Result<()>,
)

Source from the content-addressed store, hash-verified

43 Ok(n)
44}
45fn leaves(
46 values: &mut impl Values,
47 limit: usize,
48 visit: &mut impl FnMut(bool, u64, u64) -> Result<()>,
49) -> Result<()> {
50 for _ in 0..count(values, TOKENS, limit)? {
51 let op = values.value(LEAF)?;
52 match op {
53 0 => flag(values, LEAF_AFTER)?,
54 1..=3 => {}
55 _ => anyhow::bail!("unknown leaf operation"),
56 }
57 if op == 0 || op == 2 {
58 let tag = values.value(REFERENCE)?;
59 ensure!(tag <= 2, "unknown byte reference");
60 let len = values.value(LENGTH)?;
61 visit(op == 0, tag, len)?;
62 }
63 }
64 Ok(())
65}
66pub(super) fn walk(
67 values: &mut impl Values,
68 limit: usize,

Callers 2

walkFunction · 0.70

Calls 4

countFunction · 0.70
flagFunction · 0.70
visitFunction · 0.50
valueMethod · 0.45

Tested by

no test coverage detected