MCPcopy Create free account
hub / github.com/RustCrypto/utils / decode

Function decode

blobby/src/bin/decode.rs:22–37  ·  view source on GitHub ↗
(mut reader: R, mut writer: W)

Source from the content-addressed store, hash-verified

20 }
21
22 fn decode<R: BufRead, W: Write>(mut reader: R, mut writer: W) -> io::Result<usize> {
23 let mut data = Vec::new();
24 reader.read_to_end(&mut data)?;
25 let res = blobby::parse_into_vec(&data).map_err(|e| {
26 io::Error::new(
27 io::ErrorKind::InvalidData,
28 format!("invalid blobby data: {e:?}"),
29 )
30 })?;
31 let len = res.len();
32 for blob in res {
33 writer.write_all(encode_hex(blob).as_bytes())?;
34 writer.write_all(b"\n")?;
35 }
36 Ok(len)
37 }
38
39 let args: Vec<String> = env::args().skip(1).collect();
40

Callers 1

mainFunction · 0.70

Calls 3

parse_into_vecFunction · 0.85
encode_hexFunction · 0.85
lenMethod · 0.80

Tested by

no test coverage detected