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

Function vector

atomic-core/examples/graph_codec_lab/codec.rs:43–52  ·  view source on GitHub ↗
(input: &mut &'a [u8], limit: usize)

Source from the content-addressed store, hash-verified

41 Ok(bytes)
42}
43fn vector<'a>(input: &mut &'a [u8], limit: usize) -> Result<Vec<&'a [u8]>> {
44 let n = usize::try_from(get(input)?)?;
45 ensure!(n <= limit && n <= input.len(), "graph vector count limit");
46 let mut values = Vec::new();
47 values.try_reserve_exact(n)?;
48 for _ in 0..n {
49 values.push(slice(input)?);
50 }
51 Ok(values)
52}
53fn parse(mut input: &[u8]) -> Result<Borrowed<'_>> {
54 let control = slice(&mut input)?;
55 let numbers = vector(&mut input, 4096)?;

Callers 1

parseFunction · 0.70

Calls 3

sliceFunction · 0.85
getFunction · 0.70
pushMethod · 0.45

Tested by

no test coverage detected