[][src]Trait async_resol_vbus::IdHash

pub trait IdHash {
    fn id_hash<H>(&self, h: &mut H)
    where
        H: Hasher
; }

A trait to generate an identification hash for any of the VBus data types.

Required methods

fn id_hash<H>(&self, h: &mut H) where
    H: Hasher

Creates an identification hash for this VBus data value.

Loading content...

Implementors

impl IdHash for Data[src]

impl IdHash for DataSet[src]

impl IdHash for Datagram[src]

fn id_hash<H>(&self, h: &mut H) where
    H: Hasher
[src]

Returns an identification hash for this Datagram.

The hash contains all fields that count towards the "identity" of the Datagram:

  • channel
  • destination_address
  • source_address
  • protocol_version
  • command
  • param16 (if command equals 0x0900)

Examples

use resol_vbus::{Header, Datagram, id_hash};
use resol_vbus::utils::utc_timestamp;

let dgram = Datagram {
    header: Header {
        timestamp: utc_timestamp(1485688933),
        channel: 0x11,
        destination_address: 0x1213,
        source_address: 0x1415,
        protocol_version: 0x26,
    },
    command: 0x1718,
    param16: 0x191a,
    param32: 0x1b1c1d1e,
};

assert_eq!(2264775891674525017, id_hash(&dgram));

impl IdHash for Header[src]

fn id_hash<H>(&self, h: &mut H) where
    H: Hasher
[src]

Returns an identification hash for this Header.

The hash contains all fields that count towards the "identity" of the Header:

  • channel
  • destination_address
  • source_address
  • protocol_version

Examples

use resol_vbus::{Header, id_hash};
use resol_vbus::utils::utc_timestamp;

let header = Header {
    timestamp: utc_timestamp(1485688933),
    channel: 0x11,
    destination_address: 0x1213,
    source_address: 0x1415,
    protocol_version: 0x16,
};

assert_eq!(8369676560183260683, id_hash(&header));

impl IdHash for Packet[src]

fn id_hash<H>(&self, h: &mut H) where
    H: Hasher
[src]

Returns an identification hash for this Packet.

The hash contains all fields that count towards the "identity" of the Packet:

  • channel
  • destination_address
  • source_address
  • protocol_version
  • command

Examples

use resol_vbus::{Header, Packet, id_hash};
use resol_vbus::utils::utc_timestamp;

let packet = Packet {
    header: Header {
        timestamp: utc_timestamp(1485688933),
        channel: 0x11,
        destination_address: 0x1213,
        source_address: 0x1415,
        protocol_version: 0x16,
    },
    command: 0x1718,
    frame_count: 0x19,
    frame_data: [0u8; 508],
};

assert_eq!(2215810099849021132, id_hash(&packet));

impl IdHash for Telegram[src]

fn id_hash<H>(&self, h: &mut H) where
    H: Hasher
[src]

Returns an identification hash for this Telegram.

The hash contains all fields that count towards the "identity" of the Telegram:

  • channel
  • destination_address
  • source_address
  • protocol_version
  • command

Examples

use resol_vbus::{Header, Telegram, id_hash};
use resol_vbus::utils::utc_timestamp;

let tgram = Telegram {
    header: Header {
        timestamp: utc_timestamp(1485688933),
        channel: 0x11,
        destination_address: 0x1213,
        source_address: 0x1415,
        protocol_version: 0x36,
    },
    command: 0x17,
    frame_data: [0u8; 21],
};

assert_eq!(7671625633196679790, id_hash(&tgram));
Loading content...