Getting ready

Follow the following steps to set up the project and install the dependencies:

  1. Create a new binary project named sample_rand, and enter the directory:
      cargo new --bin sample_rand && cd sample_rand
  1. Install the cargo-edit tool that allows you to add and remove dependencies by modifying your Cargo.toml:
      cargo install cargo-edit
  1. Install the rand dependency:
      cargo add rand
  1. cargo add crate_name automatically adds the latest version of the dependency to the Cargo.toml file.
  2. Install the dependency by running the following command:
      cargo run
  1. This step will print hello world as output, as we have not yet made any modifications to the source code.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.129.210.91