Continuing the discussion from mdBook v0.0.1 on Crates.io:
[quote=“Azerupi, post:1, topic:2343, full:true”]
There are two main parts of this crate:
- The library: the crate is structured so that all the code that actually does something is part of the library. You could therefore easily hook mdbook into your existing project, extend it’s functionality by wrapping it in some other code, etc.
The binary: just provides a nice command line interface for the features in the library.
I also maintain a crate that is mainly a lib but also contains a bin. I however decided to put the bin into a sub-directory, with its own
Cargo.toml, partly because the bin depends on
clap and I didn’t want to make
clap a dependency of the library.
Is there a way to merge both and allow to have the lib depend on different crates than the bin?
So that I could say something like
$ cargo build --bin or
$ cargo build --lib where
--lib is the default, similar to
$ cargo new and
$ cargo new --bin.