Struct signal_gen_cjds66_lib::serial::SerialPortType[][src]

pub struct SerialPortType {
    pub port: Option<Box<dyn SerialPort>>,
    pub mock: bool,
    pub mock_num: u64,
}
Expand description

A type which wraps the serial crate’s SerialPort type, for test mocking convenience.

All of the functions in the command module expect a value of this type as their first parameter.

Fields

port: Option<Box<dyn SerialPort>>

The serial port connection.

mock: bool

Are we mocking a serial port for testing? If true, the port variable will be None and you shouldn’t try to use it.

mock_num: u64

Mock a specific numbered condition.

Implementations

The SerialPortType constructor. Pass in the path to the device for arg and set mock to false, to open a serial connection to a real device.

If you want to instantiate without connecting to a serial device, maybe for test mocking convenience for example, pass an empty string for arg and set mock to true, and pass a mock_num to choose which numbered condition to mock.

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