Skip to main content

beve_to_json_with

Function beve_to_json_with 

Source
pub fn beve_to_json_with<O: Options>(input: &[u8]) -> Result<String>
Expand description

beve_to_json under an explicit write policy.

Indenting the result is what makes this the answer to “what is actually in this file”: the document has no schema to consult, so the shape has to come off the page.

use structio::{Pretty, to_beve, transcode::beve_to_json_with};

let doc = to_beve(&vec![1u8, 2]);
assert_eq!(beve_to_json_with::<Pretty>(&doc).unwrap(), "[\n  1,\n  2\n]");