pub fn encode_stream<W: Write>(
value: &Value,
writer: &mut W,
options: Option<&EncodeOptions>,
) -> Result<(), Error>Expand description
Encode a JSON value to TOON format and write it to a writer
This function streams the output directly to the writer without building the entire string in memory, making it suitable for large datasets.
§Arguments
value- The JSON value to encodewriter- The writer to write the TOON-formatted output tooptions- Optional encoding options
§Returns
A Result indicating success or failure
§Example
use std::fs::File;
use std::io::BufWriter;
use serde_json::json;
use toon_rust::encode_stream;
let data = json!({"name": "Alice", "age": 30});
let file = File::create("output.toon").unwrap();
let mut writer = BufWriter::new(file);
encode_stream(&data, &mut writer, None).unwrap();