I created this repository as a minimum reproduction. https://github.com/SavinaRoja/diesel_test
Basically I haven't been able to figure out how to define my diesel schema, models, etc. in one lib crate that I can use in one or more external binary crates.
I have laid out two crates here. One is the lib binding to a toy mysql database/table. This has a test binary application within that works. The second crate is a binary that references the first as a dependency and implements the same code as the test before but it does not work.
The error give at a
cargo run is:
Compiling appstuff v0.1.0 (.../diesel_test/appstuff) error[E0433]: failed to resolve: use of undeclared type or module `diesel` --> src/main.rs:1:5 | 1 | use diesel::prelude::*; | ^^^^^^ use of undeclared type or module `diesel` error[E0599]: no method named `load` found for struct `dbstuff::schema::post::table` in the current scope --> src/main.rs:10:10 | 10 | .load::<Post>(&connection) | ^^^^ method not found in `dbstuff::schema::post::table` | = 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: | 1 | use diesel::query_dsl::RunQueryDsl; | error: aborting due to 2 previous errors
Any help or references to example code would be greatly appreciated. I'm new to Rust and not certain if this is an issue specific to diesel; it could just be that I am not understanding the dependency import system well enough.