How to refer to adjacent to without knowing crate name?

I expect the answer is: "You can't get there from here", but I will ask anyway.

I have a project that I just refactored into and (following the outline in the book). I'm not wild about the project name, so I just picked something random ("clist") when I first created it. I expect it will change as my project matures.

The problem is, when the project does mature, I will have to change the name in (at least) two places: Cargo.toml and (plus any other binaries I place adjacent to

Is there some way in to refer to the modules defined in without knowing the name of the crate defined in Cargo.toml? I tried crate::, super::, super::lib::, etc... and nothing seemed to work.

As I said, I expect the answer will be "You can't get there from here", and I'll just refer to the library by the random name I stuck in the Cargo.toml file.


You can add a re-export in your file.

pub use your_crate_name as some_other_name;

Thank you Alice... I guess my question/point is that, if I change the name of the package in Cargo.toml, I will have to make a corresponding change in (and any parallel bin crates).


Yes, you will. However anything that accesses it using the re-export wont have to be changed as long as you use the reexport.

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.