Function nereon::libucl::ucl_to_json[][src]

pub fn ucl_to_json(src: &mut Read) -> Result<String>

Converts UCL content from src into a JSON String

Examples

Basic usage:

let ucl = "greeting: \"hello\"";
let mut reader = ucl.as_bytes();
assert_eq!(ucl_to_json(&mut reader).unwrap(), "{\"greeting\":\"hello\"}");

Remarks

A minimal wrapper around libucl.

This function does not perform variable substitution. If you need variable substitution consider using nereon::ucl_to_serde_json.

Note: The C string returned from libucl's ucl_object_emit cannot safely be freed from Rust and so it's memory is leaked.