[][src]Enum bgb_link::commands::typed::TypedBgbCommand

pub enum TypedBgbCommand {
    Version {
        valid: bool,
    },
    Joypad {
        button_number: u8,
        pressed: bool,
    },
    Sync1 {
        data: u8,
        high_speed: bool,
        double_speed: bool,
        timestamp: u32,
    },
    Sync2 {
        data: u8,
    },
    Sync3Response,
    Sync3Timestamp {
        timestamp: u32,
    },
    Status {
        running: bool,
        paused: bool,
        support_reconnect: bool,
    },
    WantDisconnect,
}

Particular commands and their relevant data.

Variants

Version

Fields of Version

valid: bool
Joypad

Fields of Joypad

button_number: u8pressed: bool
Sync1

Fields of Sync1

data: u8high_speed: booldouble_speed: booltimestamp: u32
Sync2

Fields of Sync2

data: u8
Sync3Response
Sync3Timestamp

Fields of Sync3Timestamp

timestamp: u32
Status

Fields of Status

running: boolpaused: boolsupport_reconnect: bool
WantDisconnect

Methods

impl TypedBgbCommand[src]

pub fn to_raw(&self) -> RawBgbCommand[src]

Places the command data in the proper fields for serialization.

pub fn from_raw(raw: &RawBgbCommand) -> Result<TypedBgbCommand, CommandError>[src]

Reads the command data from the raw fields.

In most cases, this will accept malformed input and either ignore it or pass it along. The exceptions are if b1 is not recognized as a valid command type or if the b2 field of a sync3 command is not recognized.

pub fn deserialize(bytes: &[u8; 8]) -> Result<TypedBgbCommand, CommandError>[src]

Read the provided buffer directly as a command.

Trait Implementations

impl BgbCommand for TypedBgbCommand[src]

impl Clone for TypedBgbCommand[src]

impl Debug for TypedBgbCommand[src]

impl PartialEq<TypedBgbCommand> for TypedBgbCommand[src]

impl StructuralPartialEq for TypedBgbCommand[src]

Auto Trait Implementations

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.