MCPcopy Create free account
hub / github.com/Dstack-TEE/dstack / hex_encode_io

Function hex_encode_io

dstack-util/src/main.rs:306–316  ·  view source on GitHub ↗
(io: &mut impl Read)

Source from the content-addressed store, hash-verified

304
305fn cmd_hex(hex_args: HexCommand) -> Result<()> {
306 fn hex_encode_io(io: &mut impl Read) -> Result<()> {
307 loop {
308 let mut buf = [0; 1024];
309 let n = io.read(&mut buf).context("Failed to read from stdin")?;
310 if n == 0 {
311 break;
312 }
313 print!("{}", hex_fmt::HexFmt(&buf[..n]));
314 }
315 Ok(())
316 }
317 if let Some(filename) = hex_args.filename {
318 let mut input =
319 fs::File::open(&filename).context(format!("Failed to open {}", filename))?;

Callers 1

cmd_hexFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected