[][src]Struct async_resol_vbus::DataSet

pub struct DataSet {
    pub timestamp: DateTime<Utc>,
    // some fields omitted
}

A DataSet contains a set of unique (non-identical) Data values.

Examples

use std::io::Read;

use resol_vbus::{DataSet, RecordingReader, Result};

fn print_data_ids<R: Read>(r: R) -> Result<()> {
    let mut rr = RecordingReader::new(r);

    let mut cumultative_data_set = DataSet::new();

    while let Some(data_set) = rr.read_data_set()? {
        let timestamp = data_set.timestamp;

        cumultative_data_set.add_data_set(data_set);

        println!("{}:", timestamp);
        for data in cumultative_data_set.iter() {
            println!("    - {}", data.id_string());
        }
    }

    Ok(())
}

Fields

timestamp: DateTime<Utc>

The timestamp that corresponds to the contained set of Data values.

Methods

impl DataSet[src]

pub fn new() -> DataSet[src]

Construct an empty DataSet.

pub fn from_data(timestamp: DateTime<Utc>, set: Vec<Data>) -> DataSet[src]

Construct a DataSet from a list of Data values.

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

Return the amount of Data values contained in this DataSet.

pub fn is_empty(&self) -> bool[src]

Return whether this DataSet is empty.

pub fn as_data_slice(&self) -> &[Data][src]

Return the Data values contained in this DataSet.

pub fn add_data(&mut self, data: Data)[src]

Add a Data value, replacing any identical existing one.

pub fn add_data_set(&mut self, data_set: DataSet)[src]

Add all Data values from one DataSet into another.

pub fn remove_all_data(&mut self)[src]

Remove all Data values.

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

Remove Data values with timestamps older than min_timestamp.

pub fn clear_all_packets(&mut self)[src]

Find all Packet values and set their frame_count to zero effectively hiding their frame_data payload.

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

Find all Packet values with timestamps older than min_timestamp and set their frame_count to zero effectively hiding their frame_data payload.

pub fn iter(&self) -> Iter<Data>[src]

Returns an iterator over the Data values.

pub fn iter_mut(&mut self) -> IterMut<Data>[src]

Returns an iterator over the Data values.

pub fn sort(&mut self)[src]

Sort the Data values contained in this DataSet.

pub fn sort_by<F>(&mut self, f: F) where
    F: FnMut(&Data, &Data) -> Ordering
[src]

Sort the Data values contained in this DataSet.

pub fn sort_by_id_slice(&mut self, ids: &[PacketId])[src]

Sort the Data values contained in this DataSet by a list of known PacketId values.

Trait Implementations

impl AsRef<[Data]> for DataSet[src]

impl Clone for DataSet[src]

impl Debug for DataSet[src]

impl Default for DataSet[src]

impl IdHash for DataSet[src]

Auto Trait Implementations

impl RefUnwindSafe for DataSet

impl Send for DataSet

impl Sync for DataSet

impl Unpin for DataSet

impl UnwindSafe for DataSet

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> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.