pub struct Serial { /* private fields */ }
Expand description
Represents an IoTransport
layer based on a serial connection.
Uses serialport crate.
Implementations§
Source§impl Serial
impl Serial
Sourcepub fn new<P: Into<String>>(port: P) -> Self
pub fn new<P: Into<String>>(port: P) -> Self
Constructs a new Serial
transport layer instance for communication through the specified port.
§Example
use hermes_five::hardware::Board;
use hermes_five::io::RemoteIo;
#[hermes_five::runtime]
async fn main() {
let protocol = RemoteIo::new("/dev/ttyACM0");
let board = Board::new(protocol).open();
}
Trait Implementations§
Source§impl IoTransport for Serial
impl IoTransport for Serial
Source§fn open(&mut self) -> Result<(), Error>
fn open(&mut self) -> Result<(), Error>
Opens communication (in a blocking way) using the transport layer. Read more
Source§fn set_timeout(&mut self, duration: Duration) -> Result<(), Error>
fn set_timeout(&mut self, duration: Duration) -> Result<(), Error>
Sets a timeout for the transport layer Read more
Source§fn write(&mut self, buf: &[u8]) -> Result<(), Error>
fn write(&mut self, buf: &[u8]) -> Result<(), Error>
Write bytes to the internal connection. For more details see
std::io::Write::write
. Read moreSource§fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>
fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>
Reads from the internal connection. For more details see
std::io::Read::read_exact
. Read moreAuto Trait Implementations§
impl Freeze for Serial
impl !RefUnwindSafe for Serial
impl Send for Serial
impl Sync for Serial
impl Unpin for Serial
impl !UnwindSafe for Serial
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more