Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Can I rename lib.rs to the crate name?

Right now I’m working on a project with multiple separate crates.

I would prefer lib.rs to be renamed to the crate’s name itself, as when I open multiple at the same time it takes me an extra second to find the one I’m looking for, not a big deal just curious if it’s possible or a good idea.

many lib.rs files open at the same time in ide

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

ne_log/lib.rs into: ne_log/ne_log.rs

>Solution :

Yes, in each Cargo.toml add a lib section with the desired path:

[lib]
path = "src/some_other_file.rs"

Read more here: Cargo Targets

As to whether its a good idea or not; it will make your file structure non-standard, but the option is available since there are plenty of non-standard workflows. Use your own discretion.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading