Enum resol_vbus::Data

source ·
pub enum Data {
    Packet(Packet),
    Datagram(Datagram),
    Telegram(Telegram),
}
Expand description

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.

Implementations§

Returns true if the variant is a Packet.

Returns true if the variant is a Packet.

Returns true if the variant is a Packet.

Returns the Packet value, consuming the Data value.

Panics

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

Returns the Datagram value, consuming the Data value.

Panics

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

Returns the Telegram value, consuming the Data value.

Panics

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

Returns the Header part of the variant inside this Data.

Returns the Packet value.

Panics

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

Returns the Datagram value.

Panics

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

Returns the Telegram value.

Panics

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

Creates an identification string for the variant inside this Data.

Trait Implementations§

Converts this type into a shared reference of the (usually inferred) input type.
Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Creates an identification hash for this VBus data value.

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.

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

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.

This method tests less than (for self and other) and is used by the < operator. Read more
This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
This method tests greater than (for self and other) and is used by the > operator. Read more
This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.