Struct RecordingReader

Source
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,

Source

pub fn new(reader: R) -> RecordingReader<R>

Constructs a RecordingReader.

Source

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.

Source

pub fn read_record(&mut self) -> Result<&[u8], Error>

Read from the stream until a valid blob of data is found.

Source

pub fn read_data_set(&mut self) -> Result<Option<DataSet>, Error>

Read from the stream until a valid DataSet variant can be decoded.

Source

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.

Source

pub fn offset(&self) -> usize

Get amount of already consumed bytes.

Trait Implementations§

Source§

impl<R> Debug for RecordingReader<R>
where R: Debug + Read,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.