Open rfuest opened 9 months ago
I think this issue is also the source of a problem using ssd1306
with rtic
:
...
error[E0599]: the method `clear_buffer` exists for mutable reference `&mut Ssd1306<I2CInterface<...>, ..., ...>`, but its trait bounds were not satisfied
--> examples/rtic/display_stuff_rtic.rs:215:28
|
215 | cx.local.display.clear_buffer();
| ^^^^^^^^^^^^ method cannot be called on `&mut Ssd1306<I2CInterface<...>, ..., ...>` due to unsatisfied trait bounds
|
::: /home/paul/.cargo/registry/src/index.crates.io-6f17d22bba15001f/display-interface-i2c-0.5.0/src/lib.rs:10:1
|
10 | pub struct I2CInterface<I2C> {
| ---------------------------- doesn't satisfy `_: WriteOnlyDataCommand`
|
...
(I have tried using several forks of ssd1306
, for example, @bugadan fork branch = "ehal1" and @markszente fork branch = "master").
At the moment the
new
methods inI2CInterface
andSPIInterface
don't have any trait bounds, which makes it possible to create instances of these types which don't implement theWriteOnlyCommand
trait. This makes the display interface unusable, but doesn't generate an error immediately. Requiring the necessary traits whennew
is called would generate better compiler errors and make it easier to pinpoint the cause of the error by users.