Struct flipdot::SerialSignBus [−][src]
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]
P: SerialPort,
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]
P: Debug + SerialPort,
impl<P> Eq for SerialSignBus<P> where
P: Eq + SerialPort,
[src]
P: Eq + SerialPort,
impl<P> Hash for SerialSignBus<P> where
P: Hash + SerialPort,
[src]
P: Hash + SerialPort,
pub fn hash<__H>(&self, state: &mut __H) where
__H: Hasher,
[src]
__H: Hasher,
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<P> PartialEq<SerialSignBus<P>> for SerialSignBus<P> where
P: PartialEq<P> + SerialPort,
[src]
P: PartialEq<P> + SerialPort,
pub fn eq(&self, other: &SerialSignBus<P>) -> bool
[src]
pub fn ne(&self, other: &SerialSignBus<P>) -> bool
[src]
impl<P> SignBus for SerialSignBus<P> where
P: SerialPort,
[src]
P: SerialPort,
pub fn process_message<'a>(
&mut self,
message: Message<'_>
) -> Result<Option<Message<'a>>, Box<dyn Error + 'static + Sync + Send, Global>>
[src]
&mut self,
message: Message<'_>
) -> Result<Option<Message<'a>>, Box<dyn Error + 'static + Sync + Send, Global>>
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]
P: SerialPort,
impl<P> StructuralPartialEq for SerialSignBus<P> where
P: SerialPort,
[src]
P: SerialPort,
Auto Trait Implementations
impl<P> RefUnwindSafe for SerialSignBus<P> where
P: RefUnwindSafe,
P: RefUnwindSafe,
impl<P> Send for SerialSignBus<P> where
P: Send,
P: Send,
impl<P> Sync for SerialSignBus<P> where
P: Sync,
P: Sync,
impl<P> Unpin for SerialSignBus<P> where
P: Unpin,
P: Unpin,
impl<P> UnwindSafe for SerialSignBus<P> where
P: UnwindSafe,
P: UnwindSafe,
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,
pub 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, 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.
pub 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>,