Closed chrysn closed 3 years ago
This allows using Debug on the full device, and thus .unwrap() on .into_mag_continuous().
Without this, errors like this show when trying to unwrap:
error[E0599]: the method `unwrap` exists for enum `Result<lsm303agr::Lsm303agr<I2cInterface<I2CDevice>, MagContinuous>, ModeChangeError<riot_wrappers::i2c::Error, (), lsm303agr::Lsm303agr<I2cInterface<I2CDevice>, MagOneShot>>>`, but its trait bounds were not satisfied --> src/lib.rs:20:51 | 20 | let mut sensor = sensor.into_mag_continuous().unwrap(); | ^^^^^^ method cannot be called on `Result<lsm303agr::Lsm303agr<I2cInterface<I2CDevice>, MagContinuous>, ModeChangeError<riot_wrappers::i2c::Error, (), lsm303agr::Lsm303agr<I2cInterface<I2CDevice>, MagOneShot>>>` due to unsatisfied trait bounds | ::: /home/chrysn/git/crates/lsm303agr-rs/src/types.rs:14:1 | 14 | pub struct ModeChangeError<CommE, PinE, DEV> { | -------------------------------------------- doesn't satisfy `_: Debug` | = note: the following trait bounds were not satisfied: `ModeChangeError<riot_wrappers::i2c::Error, (), lsm303agr::Lsm303agr<I2cInterface<I2CDevice>, MagOneShot>>: Debug`
For the record, I have released this in version 0.1.1.
This allows using Debug on the full device, and thus .unwrap() on .into_mag_continuous().
Without this, errors like this show when trying to unwrap: