Indeed, it is strange that crates.io does not have a clear example of this.
To add both a library and an executable file to your mailbox (BTW, a mailbox can contain only one library), you need to define them in the [lib] and [[bin]] sections:
[lib] name = "yourcrate" [[bin]] name = "yourcrate_bin_1" [[bin]] name = "yourcrate_bin_2"
With the above default, Cargo will look for the library root directory in src/lib.rs and for binaries in src/bin/yourcrate_bin_1.rs and src/bin/yourcrate_bin_2.rs . You can change the paths to the root files of the box using the path option:
[[bin]] name = "yourcrate_bin_2" path = "src/yourcrate_bin_2.rs"
source share