pub unsafe fn hashmap_json_to_cbuffer(
    json: &HashMap<String, Value>,
    buffer: *mut c_char
) -> i32
Expand description

Takes a Hashmap<String, serde_json::Value> and fallibly encodes it in JSON into a provided external Cobhan Buffer.

The JSON is fallibly checked to ensure UTF-8 formatting of any string properties.

Will cause an error code if the provided Cobhan Buffer is too small.

Notes

This function does a memcopy from the Rust data into the provided Cobhan Buffer.

Safety

Behavior is undefined if any of the following conditions are violated:

  • The Cobhan Buffer Header size is not correctly reserved or formatted.
  • Any of the Safety conditions of std::slice::from_raw_parts is violated.