pub struct SerialCli { /* private fields */ }Expand description
Serial Command-line interface.
Implementations§
Source§impl SerialCli
impl SerialCli
Sourcepub fn new(port: Box<dyn SerialPort>) -> Self
pub fn new(port: Box<dyn SerialPort>) -> Self
Create a new SerialCli connected to a SerialPort.
Sourcepub fn port(&self) -> &dyn SerialPort
pub fn port(&self) -> &dyn SerialPort
Get reference to underlying SerialPort.
Sourcepub fn port_mut(&mut self) -> &mut dyn SerialPort
pub fn port_mut(&mut self) -> &mut dyn SerialPort
Get mutable reference to underlying SerialPort.
Sourcepub fn send_and_wait_eol(&mut self, line: &str) -> Result<BytesMut>
pub fn send_and_wait_eol(&mut self, line: &str) -> Result<BytesMut>
Send line to device and wait for next end-of-line.
Sourcepub fn send_and_wait_prompt(&mut self, line: &str) -> Result<BytesMut>
pub fn send_and_wait_prompt(&mut self, line: &str) -> Result<BytesMut>
Send line to device and wait for next CLI prompt.
Sourcepub fn read_until_prompt(&mut self) -> Result<BytesMut>
pub fn read_until_prompt(&mut self) -> Result<BytesMut>
Read until next CLI prompt.
Sourcepub fn read_until_ready(&mut self) -> Result<BytesMut>
pub fn read_until_ready(&mut self) -> Result<BytesMut>
Read until next CLI “Ready?” prompt.
Sourcepub fn read_until_eol(&mut self) -> Result<BytesMut>
pub fn read_until_eol(&mut self) -> Result<BytesMut>
Read until next end-of-line.
Sourcepub fn consume_response(&mut self) -> Result<String>
pub fn consume_response(&mut self) -> Result<String>
Consume command respose, checking for errors.
Auto Trait Implementations§
impl Freeze for SerialCli
impl !RefUnwindSafe for SerialCli
impl Send for SerialCli
impl !Sync for SerialCli
impl Unpin for SerialCli
impl !UnwindSafe for SerialCli
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