pub struct RecordingReader<R>where
R: Read,{ /* private fields */ }
Expand description
Allows reading Data
variants from a Read
trait object.
§Examples
use resol_vbus::{FileListReader, RecordingReader};
let files: Vec<_> = std::env::args().skip(1).collect();
let flr = FileListReader::new(files);
let mut rr = RecordingReader::new(flr);
while let Some(data_set) = rr.read_data_set().unwrap() {
// process the data set
println!("{}:", data_set.timestamp);
for data in data_set.iter() {
println!(" - {}", data.id_string());
}
}
Implementations§
Source§impl<R> RecordingReader<R>where
R: Read,
impl<R> RecordingReader<R>where
R: Read,
Sourcepub fn new(reader: R) -> RecordingReader<R>
pub fn new(reader: R) -> RecordingReader<R>
Constructs a RecordingReader
.
Sourcepub fn set_min_max_timestamps(
&mut self,
min_timestamp: Option<DateTime<Utc>>,
max_timestamp: Option<DateTime<Utc>>,
)
pub fn set_min_max_timestamps( &mut self, min_timestamp: Option<DateTime<Utc>>, max_timestamp: Option<DateTime<Utc>>, )
Set optional minimum and maximum timestamps for prefiltering data.
Sourcepub fn read_record(&mut self) -> Result<&[u8], Error>
pub fn read_record(&mut self) -> Result<&[u8], Error>
Read from the stream until a valid blob of data is found.
Sourcepub fn read_data_set(&mut self) -> Result<Option<DataSet>, Error>
pub fn read_data_set(&mut self) -> Result<Option<DataSet>, Error>
Read from the stream until a valid DataSet
variant can be decoded.
Sourcepub fn read_topology_data_set(&mut self) -> Result<DataSet, Error>
pub fn read_topology_data_set(&mut self) -> Result<DataSet, Error>
Quickly read to EOF of the source and return the DataSet for all uniquely found Data
variants.
Trait Implementations§
Auto Trait Implementations§
impl<R> Freeze for RecordingReader<R>where
R: Freeze,
impl<R> RefUnwindSafe for RecordingReader<R>where
R: RefUnwindSafe,
impl<R> Send for RecordingReader<R>where
R: Send,
impl<R> Sync for RecordingReader<R>where
R: Sync,
impl<R> Unpin for RecordingReader<R>where
R: Unpin,
impl<R> UnwindSafe for RecordingReader<R>where
R: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more