Skip to main content

read_into

Function read_into 

Source
pub fn read_into<'de, T>(value: &mut T, input: &'de str) -> Result<()>
where T: Read<'de>,
Expand description

Parse a JSON document into an existing value.

Prefer this in a loop: the destination keeps its allocations between calls, so repeated parses of the same shape settle into doing no allocation at all.

On failure value is left partially written. That is deliberate, and matches Glaze: recovering the untouched original would mean copying it first, on every call, to serve the failing case.