[−][src]Enum async_resol_vbus::Data
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]
pub fn as_datagram(&self) -> &Datagram
[src]
pub fn as_telegram(&self) -> &Telegram
[src]
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.
#[must_use]fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
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.
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,