Closed
Description
Is it intentional that there are no bounds on the associated Error types for the i2c traits?
As they are not guaranteed to implement anything, it doesn't seem to be possible to make a custom Error
type which can implement From
for them in a useful way.
It would be nice to be able to write code like this:
fn frob_foos(read: &mut impl Read, write: &mut impl Write) -> Result<bool, MyErrorType???> {
write.write(ADDR, &[6, 0])?;
write.write(ADDR, &[7, 0xFF])?;
write.write(ADDR, &[2, 0x55])?;
write.write(ADDR, &[0])?;
let mut buf = [0u8];
read.read(ADDR, &mut buf)?;
// ...
}
Metadata
Metadata
Assignees
Labels
No labels