Struct htu2xd::ResultReader [−][src]
pub struct ResultReader<'h, I, M> { /* fields omitted */ }
A proxy used to read the result of a non-blocking measurement
Implementations
impl<'h, I, M> ResultReader<'h, I, M> where
I: Read,
M: Measurement,
[src]
I: Read,
M: Measurement,
pub fn read_result<F>(
&mut self,
i2c: &mut I,
is_nak: F
) -> Result<Reading<M>, Error<I::Error>> where
F: FnOnce(&I::Error) -> bool,
[src]
&mut self,
i2c: &mut I,
is_nak: F
) -> Result<Reading<M>, Error<I::Error>> where
F: FnOnce(&I::Error) -> bool,
Attempts to read a measurement result from the sensor
is_nak must be a closure that returns true if the provided error is a NAK (negative acknowledge) error, or false otherwise.
This function returns Err(nb::Error::WouldBlock)
if the sensor does not acknowledge
its address. This means that it is still performing the measurement. This function should
be called again later to try again.
On success, this function returns the sensor reading.
After this function returns anything other than Err(nb::Error::WouldBlock)
, this
ResultReader
must not be used again.
Auto Trait Implementations
impl<'h, I, M> Send for ResultReader<'h, I, M> where
I: Send,
M: Send,
I: Send,
M: Send,
impl<'h, I, M> Sync for ResultReader<'h, I, M> where
I: Sync,
M: Sync,
I: Sync,
M: Sync,
impl<'h, I, M> Unpin for ResultReader<'h, I, M> where
M: Unpin,
M: Unpin,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,