While reading the official book, I stumbled upon packages and crates. To create a new "project", this is what I ran:
$ cargo new my-project
Created binary (application) `my-project` package
$ ls my-project
Cargo.toml
src
$ ls my-project/src
main.rs
The book states the following:
A package must contain zero or one library crates, and no more. It can contain as many binary crates as you’d like, but it must contain at least one crate (either library or binary).
My doubt is, what is the difference between binary crates and normal crates?
Rust programs may contain a binary crate or a library crate. A binary crate is an executable project that has a main() method. A library crate is a group of components that can be reused in other projects. Unlike a binary crate, a library crate does not have an entry point (main() method).
The Military Crate (also known as the Gun Crate) contains higher quality items than Basic Crates or Tool Boxes. These crates are only found in Monuments. The Military Crate can contain: High Quality Metal.
A crate is the smallest amount of code that the Rust compiler considers at a time. Even if you run rustc rather than cargo and pass a single source code file (as we did all the way back in the “Writing and Running a Rust Program” section of Chapter 1), the compiler considers that file to be a crate.
One of the most simple ways to obtain free skins in RUST is to simply load the game up. RUST has Steam's Playtime Item Grants enabled, which rewards players with free RUST skins and in rare cases skin crates, for simply having the game client open. It doesn't matter whether you're idle or actively playing on a server.
The difference is between binary crate and library crate. There are no "normal" crates.
A binary crate is an executable program.
A library crate is a library of reusable components that can be included in another library crate or in a binary crate.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With