Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a small example of how to turn the devenv binary into both a library and a binary. The reason this works is that the devenv/Cargo.toml file would allow you to specify one or more binaries, and only a single library. However, because we are using the default values for everything, we do not need to explicitly define these sections. The library entry point will be devenv/src/lib.rs.
In the lib.rs file, we specify that we also want to use the log module. So we define and export this module. So now anything that imports the devenv package can just use devenv::log::* in order to access the pieces defined inside of that module.
There is a problem including the command module since main.rs defines an App struct, and then the command module defines an implementation of that struct. The problem here being that lib.rs does not define the App struct, so when the command module has use crate::App, it is not defined as it is in the case of the devenv binary.