Struct flipdot::SerialSignBus[][src]

pub struct SerialSignBus<P> where
    P: SerialPort, 
{ /* fields omitted */ }

An implementation of SignBus that communicates with one or more signs over serial.

Messages and responses are logged using the log crate for debugging purposes. Consuming binaries typically use the env_logger crate and can be run with the RUST_LOG=debug environment variable to watch the bus messages go by.

Examples

use flipdot_serial::SerialSignBus;

let port = serial::open("/dev/ttyUSB0")?;
let bus = SerialSignBus::try_new(port)?;
// Can now connect a Sign to the bus.

Implementations

impl<P> SerialSignBus<P> where
    P: SerialPort, 
[src]

pub fn try_new(port: P) -> Result<SerialSignBus<P>, Error>[src]

Creates a new SerialSignBus that communicates over the specified serial port.

Errors

Returns the underlying [serial_core::Error] if the serial port cannot be configured.

Examples

let port = serial::open("COM3")?;
let bus = SerialSignBus::try_new(port)?;

pub fn port(&self) -> &P[src]

Returns a reference to the underlying serial port.

Trait Implementations

impl<P> Debug for SerialSignBus<P> where
    P: Debug + SerialPort, 
[src]

impl<P> Eq for SerialSignBus<P> where
    P: Eq + SerialPort, 
[src]

impl<P> Hash for SerialSignBus<P> where
    P: Hash + SerialPort, 
[src]

impl<P> PartialEq<SerialSignBus<P>> for SerialSignBus<P> where
    P: PartialEq<P> + SerialPort, 
[src]

impl<P> SignBus for SerialSignBus<P> where
    P: SerialPort, 
[src]

pub fn process_message<'a>(
    &mut self,
    message: Message<'_>
) -> Result<Option<Message<'a>>, Box<dyn Error + 'static + Sync + Send, Global>>
[src]

Handles a bus message by sending it to the serial port and reading a response if necessary.

impl<P> StructuralEq for SerialSignBus<P> where
    P: SerialPort, 
[src]

impl<P> StructuralPartialEq for SerialSignBus<P> where
    P: SerialPort, 
[src]

Auto Trait Implementations

impl<P> RefUnwindSafe for SerialSignBus<P> where
    P: RefUnwindSafe

impl<P> Send for SerialSignBus<P> where
    P: Send

impl<P> Sync for SerialSignBus<P> where
    P: Sync

impl<P> Unpin for SerialSignBus<P> where
    P: Unpin

impl<P> UnwindSafe for SerialSignBus<P> where
    P: UnwindSafe

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