title: What's the difference between binary and library in Rust?
body: <p>What's the difference between binary and library in Rust?
  I read <a href="https://doc.rust-lang.org/cargo/guide/creating-a-new-project.html" rel="nofollow noreferrer">The Cargo Book</a>, but couldn't understand it well.</p>
  
  <p>I generated two folders using <code>cargo new a --bin</code> and <code>cargo new b --lib</code>, however, both of them look the same inside. What are the purposes of <code>--bin</code> and <code>--lib</code>? And what are the difference between them?</p>