Here are some of the commonly used cargo commands. Output Finished dev target(s) in 0.05sĬargo can do a bunch of repetitive tasks for us. The cargo build command first installs any crates that are in use inside the src/ directory and then proceeds to compile the project. Here's how:Ĭompiling hello_world v0.1.0 (/experiments/rust-practice/hello_world)įinished dev target(s) in 2.57s We can use cargo to install, build and run our hello_world project with the "rand" crate. Println!("roll = ", rng.gen_range(1.=6)) īuilding and Running Project with Cargo in Rust The use keyword is used here to import items (such as functions, types, and constants) from the "rand" crate in the current scope.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |