cargo-play
cargo-play copied to clipboard
Using local modules
First of all, congrats for the awesome work you've put in here!
I've got the following files:
src
├── foo.rs
├── lib.rs
├── main.rs
I am trying to use some content from my lib, but the imports won't resolve even if I use cargo play src/main.rs src/lib.rs src/foo.rs
How can I use my own library?
One hack you can do is to specify the dependency with its path. For example, I have a Rust library at ~/playground/testlib
. I can write the following to use code in that library:
//# testlib = { path = "/Users/fanzeyi/playground/testlib" }
use testlib::foobar;
fn main() {
println!("test");
foobar();
}
This is a little tedious. Let me see if I can make it so cargo-play
can convert relative path to absolute path.