pub fn get_message_buf<T: Read>(
    source: &mut T,
    leftover: String
) -> Result<(String, TeleinfoMessage)>
Expand description

Read message from an readable object source bufferized, with leftover being the unparsed string from a previous call Returns a tuple with data to be parsed in a next call string as leftover and the first found TeleinfoMessage

Example

use std::fs::File;
// Could be a serial port with serialport crate
let mut stream = File::open("assets/stream_standard_raw.txt").unwrap();
let (remain, msg1) = teleinfo_nom::get_message_buf(&mut stream, "".to_string()).unwrap();