Hello, I am quite new to Rust, who is reading the Rust Programming Book!
I got curious what is the difference between cargo new --lib and cargo new --bin.
More specifically, if once I create a new package using cargo new --bin and later decided to add src/lib.rs, I was not able to import contents in lib.rs, using extern crate <package name>.
However, the opposite way works very well.
What is the key difference that those packages created from --lib flag and --bin flag behave differently?
It's implied by the source files. If there's a src/main.rs, that is compiled as a binary. If there's a src/lib.rs, that is compiled as a library. Each src/bin/*.rs is compiled as a binary.