Struct resol_vbus::LiveDataReader
source · pub struct LiveDataReader<R: Read> { /* private fields */ }
Expand description
Allows reading Data
variants from a Read
trait object.
Examples
use resol_vbus::{FileListReader, LiveDataReader};
let files: Vec<_> = std::env::args().skip(1).collect();
let flr = FileListReader::new(files);
let mut ldr = LiveDataReader::new(0, flr);
while let Some(data) = ldr.read_data().unwrap() {
// process the data
println!("{}", data.id_string());
}
Implementations§
source§impl<R: Read> LiveDataReader<R>
impl<R: Read> LiveDataReader<R>
sourcepub fn new(channel: u8, reader: R) -> LiveDataReader<R>
pub fn new(channel: u8, reader: R) -> LiveDataReader<R>
Constructs a LiveDataReader
.
sourcepub fn read_bytes(&mut self) -> Result<Option<&[u8]>>
pub fn read_bytes(&mut self) -> Result<Option<&[u8]>>
Read from the stream until a valid blob of data is found.