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

Function parse

atomic-core/examples/graph_codec_lab/codec.rs:53–70  ·  view source on GitHub ↗
(mut input: &[u8])

Source from the content-addressed store, hash-verified

51 Ok(values)
52}
53fn parse(mut input: &[u8]) -> Result<Borrowed<'_>> {
54 let control = slice(&mut input)?;
55 let numbers = vector(&mut input, 4096)?;
56 let bytes = slice(&mut input)?;
57 let dictionary = vector(&mut input, control.len().min(1_000_000))?;
58 let references = slice(&mut input)?;
59 let (content_hash, rest) = postcard::take_from_bytes(input)?;
60 input = rest;
61 ensure!(input.is_empty(), "trailing graph frame");
62 Ok(Borrowed {
63 control,
64 numbers,
65 bytes,
66 dictionary,
67 references,
68 content_hash,
69 })
70}
71
72fn put(out: &mut Vec<u8>, mut n: u64) {
73 while n >= 128 {

Callers 7

decode_contextFunction · 0.70
from_authorship_partsMethod · 0.50
vendor_strMethod · 0.50
decodeFunction · 0.50
decodeFunction · 0.50
org_base_urlMethod · 0.50

Calls 3

sliceFunction · 0.85
vectorFunction · 0.70
lenMethod · 0.45

Tested by 1