Skip to main content

parse_stream

Function parse_stream 

Source
pub fn parse_stream<R: Read>(reader: R) -> Result<DxValue>
Expand description

Stream parser for large files

Reads the entire contents of a reader into memory and parses it. For very large files, consider using memory-mapped I/O instead.

§Example

use serializer::parser::parse_stream;
use std::io::Cursor;

let data = Cursor::new(b"name:Test\nvalue:42");
let value = parse_stream(data).unwrap();

§Errors

Returns a DxError in the following cases:

  • DxError::Io - Failed to read from the input stream.

  • All errors from parse() - After reading, the data is parsed using the standard parser, which may return any of its error types.