MCPcopy Create free account
hub / github.com/BitVM/BitVM / write_map_to_file

Function write_map_to_file

bitvm/src/chunk/api.rs:399–410  ·  view source on GitHub ↗
(
            map: &HashMap<u32, Vec<Vec<u8>>>,
            filename: &str,
        )

Source from the content-addressed store, hash-verified

397 use std::io::Write;
398
399 pub(crate) fn write_map_to_file(
400 map: &HashMap<u32, Vec<Vec<u8>>>,
401 filename: &str,
402 ) -> Result<(), Box<dyn Error>> {
403 // Serialize the map to a JSON string
404 let json = serde_json::to_string(map)?;
405
406 // Write the JSON string to a file
407 let mut file = File::create(filename)?;
408 file.write_all(json.as_bytes())?;
409 Ok(())
410 }
411
412 #[allow(clippy::type_complexity)]
413 pub(crate) fn read_map_from_file(

Callers 3

write_scripts_to_fileFunction · 0.85
write_asserts_to_fileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected