How can I access the binary crate inside the library crate?

⚓ Rust    📅 2025-06-20    👤 surdeus    👁️ 5      

surdeus

Warning

This post was published 54 days ago. The information described in this article may have changed.

Hello,

I did a search on SO and found this https://stackoverflow.com/questions/26946646/package-with-both-a-library-and-a-binary but it does not address my question. Neither do the suggested questions here.
I have a project consisting of a lib.rs crate and a main.rs crate with a module VM in main.rs. I want to write unit tests for the VM module and to set up all the structs needed for testing I want to write a setup_vm() function in lib.rs where all the utility functions should reside in.
I do not know how to access main::VM inside lib.rs.

Thanks!

5 posts - 3 participants

Read full topic

🏷️ rust_feed