MCPcopy Create free account
hub / github.com/RizeCrime/linuxblaster_control / write_parsed

Function write_parsed

sniffer/src/main.rs:527–542  ·  view source on GitHub ↗
(path: &str)

Source from the content-addressed store, hash-verified

525}
526
527fn write_parsed(path: &str) {
528 let input = std::path::Path::new(path);
529 let stem = input.file_stem()
530 .map(|s| s.to_string_lossy().into_owned())
531 .unwrap_or_else(|| path.to_owned());
532 let out_path = format!("parsed/{stem}.json");
533
534 eprint!("{path} ... ");
535 let packets = parse_file(path);
536 fs::create_dir_all("parsed").expect("Cannot create ./parsed");
537 let out = File::create(&out_path)
538 .unwrap_or_else(|e| panic!("Cannot create {out_path}: {e}"));
539 serde_json::to_writer_pretty(BufWriter::new(out), &packets)
540 .expect("JSON serialization failed");
541 eprintln!("wrote {} packets → {out_path}", packets.len());
542}
543
544fn main() {
545 let args: Vec<String> = env::args().skip(1).collect();

Callers 1

mainFunction · 0.85

Calls 1

parse_fileFunction · 0.85

Tested by

no test coverage detected