| 51 | Ok(values) |
| 52 | } |
| 53 | fn 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 | |
| 72 | fn put(out: &mut Vec<u8>, mut n: u64) { |
| 73 | while n >= 128 { |