Trait embedded_serial::MutBlockingTxWithTimeout
[−]
[src]
pub trait MutBlockingTxWithTimeout { type Timeout; type Error; fn putc_wait(
&mut self,
ch: u8,
timeout: &Self::Timeout
) -> Result<Option<u8>, Self::Error>; fn puts_wait<I: ?Sized>(
&mut self,
data: &I,
timeout: &Self::Timeout
) -> Result<usize, (usize, Self::Error)>
where
I: AsRef<[u8]>, { ... } }
Implementors of this trait offer octet based serial data transmission using a blocking API with an upper bound on blocking time, and requiring a mutable reference to self.
Associated Types
type Timeout
The type used to specify the timeout.
type Error
The error type returned if a function fails.
Required Methods
fn putc_wait(
&mut self,
ch: u8,
timeout: &Self::Timeout
) -> Result<Option<u8>, Self::Error>
&mut self,
ch: u8,
timeout: &Self::Timeout
) -> Result<Option<u8>, Self::Error>
Write a single octet to the port's transmitter, blocking until the octet can be stored in the buffer (not necessarily that the octet has been transmitted) or some timeout occurs.
In some implementations, this can result in an Error.
If not, use type Error = !
.
If it times out, Ok(None)
is returned.
If it sends the data, Ok(Some(ch))
is returned.
If it fails, Err(...)
is returned.
Provided Methods
fn puts_wait<I: ?Sized>(
&mut self,
data: &I,
timeout: &Self::Timeout
) -> Result<usize, (usize, Self::Error)> where
I: AsRef<[u8]>,
&mut self,
data: &I,
timeout: &Self::Timeout
) -> Result<usize, (usize, Self::Error)> where
I: AsRef<[u8]>,
Attempts to write a complete string to the UART. Returns number of octets written, or an error and the number of octets written. The timeout applies to each octet individually.
A result of Ok(data.len())
means all the data was sent.
A result of Ok(size < data.len())
means only some of the data was sent then there was a timeout.
A result of Err(size, e)
means some (or all) of the data was sent then there was an error.