No method X found for struct and compiler bug?

Could someone help me figure out this stuff out? The compiler is not being helpful at all. It's asking me to import an item that is already in scope.

error[E0599]: no method named `send_commands` found for struct `PGPIO8BitInterface<nrf52832_hal::gpio::Pin<Output<PushPull>>, P0_28<Output<PushPull>>, P0_04<Output<PushPull>>>` in the current scope
  --> src/main.rs:44:23
   |
44 |     ili9486_interface.send_commands(display_interface::DataFormat::U8(&data));
   |                       ^^^^^^^^^^^^^ method not found in `PGPIO8BitInterface<nrf52832_hal::gpio::Pin<Output<PushPull>>, P0_28<Output<PushPull>>, P0_04<Output<PushPull>>>`
   |
   = help: items from traits can only be used if the trait is in scope
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
   |
4  | use display_interface::WriteOnlyDataCommand;
   |

warning: unused import: `display_interface::WriteOnlyDataCommand`
 --> src/main.rs:4:5
  |
4 | use display_interface::WriteOnlyDataCommand;
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

I made a test repo because I couldn't reproduce the issue in a playground and the code would be too messy if I posted some snippets here.

If you have any suggestions of something else I could provide for more info, please let me know!

EDIT: Forgot to mention that the repo has a submodule.

This is a duplicate dependency issue, I think. Crate display-interface-parallel-gpio, which pulls in PGPIO8BitInterface, has dependency on display-interface = "0.4", i.e. it pulls the crate from crates.io. However, your own crate uses path dependency. So the trait WriteOnlyDataCommand implemented by PGPIO8BitInterface and imported into your code are really two distinct traits from two distinct crates.

I wasn't able to check this, however, since your test repo fails to build due to "multiple workspace roots". If this problem is fixed (I'm not sure yet how), you should be able to run cargo tree and see the conflict.

Right, I have the workspace stuff in the submodule stuff commented out. If you comment that out, it should give the error I posted above.

Cool, I changed the display-interface = "0.4" from the Cargo.toml in display-interface-parallel-gpio to display-interface = { path = "..", version = "0.4" } and it seems to work, thanks!

I created an issue in the Rust repo.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.