[][src]Enum async_resol_vbus::Data

pub enum Data {
    Packet(Packet),
    Datagram(Datagram),
    Telegram(Telegram),
}

Data is a type that contains one of the supported VBus protocol data variants.

Examples

use std::io::Read;

use resol_vbus::{LiveDataReader, Result};

fn print_data_ids<R: Read>(r: R) -> Result<()> {
    let mut ldr = LiveDataReader::new(0, r);

    while let Some(data) = ldr.read_data()? {
        if !data.is_packet() {
            continue;
        }

        println!("{}: {}", data.as_header().timestamp, data.id_string());
    }

    Ok(())
}

Variants

Packet(Packet)

Contains a Packet conforming to VBus protocol version 1.x.

Datagram(Datagram)

Contains a Datagram conforming to VBus protocol version 2.x.

Telegram(Telegram)

Contains a Telegram conforming to VBus protocol version 3.x.

Methods

impl Data[src]

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

Returns true if the variant is a Packet.

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

Returns true if the variant is a Packet.

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

Returns true if the variant is a Packet.

pub fn into_packet(self) -> Packet[src]

Returns the Packet value, consuming the Data value.

Panics

The function panics if the Data value is no Packet variant.

pub fn into_datagram(self) -> Datagram[src]

Returns the Datagram value, consuming the Data value.

Panics

The function panics if the Data value is no Datagram variant.

pub fn into_telegram(self) -> Telegram[src]

Returns the Telegram value, consuming the Data value.

Panics

The function panics if the Data value is no Telegram variant.

pub fn as_header(&self) -> &Header[src]

Returns the Header part of the variant inside this Data.

pub fn as_packet(&self) -> &Packet[src]

Returns the Packet value.

Panics

The function panics if the Data value is no Packet variant.

pub fn as_datagram(&self) -> &Datagram[src]

Returns the Datagram value.

Panics

The function panics if the Data value is no Datagram variant.

pub fn as_telegram(&self) -> &Telegram[src]

Returns the Telegram value.

Panics

The function panics if the Data value is no Telegram variant.

pub fn id_string(&self) -> String[src]

Creates an identification string for the variant inside this Data.

Trait Implementations

impl AsRef<Header> for Data[src]

impl Clone for Data[src]

impl Debug for Data[src]

impl From<Datagram> for Data[src]

impl From<Packet> for Data[src]

impl From<Telegram> for Data[src]

impl IdHash for Data[src]

impl PartialEq<Data> for Data[src]

fn eq(&self, right: &Data) -> bool[src]

Returns true if two Data values are "identical".

Each Data variant has a set of fields that make up its "identity". The PartialEq trait implementation checks those fields for equality and returns true if all of the fields match.

See the descriptions for the Header, Packet, Datagram and Telegram types to find out which fields are considered in each case.

impl PartialOrd<Data> for Data[src]

fn partial_cmp(&self, right: &Data) -> Option<Ordering>[src]

Compares two Data values are "identical".

Each Data variant has a set of fields that make up its "identity". The PartialOrd trait implementation compares those fields.

See the descriptions for the Header, Packet, Datagram and Telegram types to find out which fields are considered in each case.

Auto Trait Implementations

impl RefUnwindSafe for Data

impl Send for Data

impl Sync for Data

impl Unpin for Data

impl UnwindSafe for Data

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.