MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / json_to_vec

Function json_to_vec

atomic-repository/src/oci.rs:319–321  ·  view source on GitHub ↗

Serialize a JSON value to bytes, mapping serialization failure to an IO error so callers can use `?` against `std::io::Result`.

(value: &serde_json::Value)

Source from the content-addressed store, hash-verified

317/// Serialize a JSON value to bytes, mapping serialization failure to an IO error
318/// so callers can use `?` against `std::io::Result`.
319fn json_to_vec(value: &serde_json::Value) -> std::io::Result<Vec<u8>> {
320 serde_json::to_vec(value).map_err(std::io::Error::other)
321}
322
323#[cfg(test)]
324mod tests {

Callers 1

write_image_layoutFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected