Trait embedded_serial::MutBlockingRxWithTimeout
[−]
[src]
pub trait MutBlockingRxWithTimeout { type Timeout; type Error; fn getc_wait(
&mut self,
timeout: &Self::Timeout
) -> Result<Option<u8>, Self::Error>; fn gets_wait<I: ?Sized>(
&mut self,
buffer: &mut I,
timeout: &Self::Timeout
) -> Result<usize, (usize, Self::Error)>
where
I: AsMut<[u8]>, { ... } }
Implementors of this trait offer octet based serial data reception using a blocking API with an upper bound on blocking time, and requiring a mutable reference to self.
Associated Types
Required Methods
fn getc_wait(
&mut self,
timeout: &Self::Timeout
) -> Result<Option<u8>, Self::Error>
&mut self,
timeout: &Self::Timeout
) -> Result<Option<u8>, Self::Error>
Read a single octet from the port's receiver, blocking until the octet can be read from the buffer.
In some implementations, this can result in an Error.
If not, use type Error = !
.
If it times out, Ok(None) is returned. If it receives data, Ok(Some(data)) is returned. If it fails, Err(...) is returned.
Provided Methods
fn gets_wait<I: ?Sized>(
&mut self,
buffer: &mut I,
timeout: &Self::Timeout
) -> Result<usize, (usize, Self::Error)> where
I: AsMut<[u8]>,
&mut self,
buffer: &mut I,
timeout: &Self::Timeout
) -> Result<usize, (usize, Self::Error)> where
I: AsMut<[u8]>,
Read a specified number of octets into the given buffer, blocking until that many have been read or a timeout occurs.
In some implementations, this can result in an Error.
If not, use type Error = !
.
If the result is Ok(size)
but size <= buffer.len()
, you had a timeout.