[][src]Struct async_resol_vbus::RecordingReader

pub struct RecordingReader<R> where
    R: Read
{ /* fields omitted */ }

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());
    }
}

Methods

impl<R> RecordingReader<R> where
    R: Read
[src]

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

Constructs a RecordingReader.

pub fn set_min_max_timestamps(
    &mut self,
    min_timestamp: Option<DateTime<Utc>>,
    max_timestamp: Option<DateTime<Utc>>
)
[src]

Set optional minimum and maximum timestamps for prefiltering data.

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

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

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

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

pub fn read_topology_data_set(&mut self) -> Result<DataSet, Error>[src]

Quickly read to EOF of the source and return the DataSet for all uniquely found Data variants.

pub fn offset(&self) -> usize[src]

Get amount of already consumed bytes.

Trait Implementations

impl<R> Debug for RecordingReader<R> where
    R: Read + Debug
[src]

Auto Trait Implementations

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

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.