Trait embedded_serial::MutNonBlockingRx
[−]
[src]
pub trait MutNonBlockingRx { type Error; fn getc_try(&mut self) -> Result<Option<u8>, Self::Error>; fn gets_try<I: ?Sized>(
&mut self,
buffer: &mut I
) -> Result<usize, (usize, Self::Error)>
where
I: AsMut<[u8]>, { ... } }
Implementors of this trait offer octet based serial data reception using a non-blocking API, and requiring a mutable reference to self.
Associated Types
type Error
The error type returned if getc
fails.
Required Methods
fn getc_try(&mut self) -> Result<Option<u8>, Self::Error>
Attempt to read a single octet from the port's receiver; if the buffer is empty return None.
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_try<I: ?Sized>(
&mut self,
buffer: &mut I
) -> Result<usize, (usize, Self::Error)> where
I: AsMut<[u8]>,
&mut self,
buffer: &mut I
) -> Result<usize, (usize, Self::Error)> where
I: AsMut<[u8]>,
Read a specified number of octets into the given buffer, or until the data runs out.
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 ran out of data.