pub trait MutNonBlockingRx {
type Error;
// Required method
fn getc_try(&mut self) -> Result<Option<u8>, Self::Error>;
// Provided method
fn gets_try<I>(
&mut self,
buffer: &mut I,
) -> Result<usize, (usize, Self::Error)>
where I: AsMut<[u8]> + ?Sized { ... }
}Expand description
Implementors of this trait offer octet based serial data reception using a non-blocking API, and requiring a mutable reference to self.
Required Associated Types§
Required Methods§
Sourcefn getc_try(&mut self) -> Result<Option<u8>, Self::Error>
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§
Sourcefn gets_try<I>(&mut self, buffer: &mut I) -> Result<usize, (usize, Self::Error)>
fn gets_try<I>(&mut self, buffer: &mut I) -> Result<usize, (usize, Self::Error)>
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.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".