Enum resol_vbus::Data[][src]

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.

Tuple Fields of Packet

0: Packet
Datagram(Datagram)

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

Tuple Fields of Datagram

0: Datagram
Telegram(Telegram)

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

Tuple Fields of Telegram

0: Telegram

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

Performs the conversion.

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Performs the conversion.

Performs the conversion.

Performs the conversion.

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 !=.

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

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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.