Crates - general explanation

// cargo.toml

[package]
name = "mandelbrot"
version = "0.2.0"
authors = ["Jim Blandy <[email protected]>"]
edition = "2018"

[dependencies]
num = "0.4"
image = "0.13.0"
rayon = "1"

use num::Complex;
use rayon::prelude::*;

Dependencies

how Cargo recognize crates on cargo.toml

  1. Developer write crate info on the file
  2. Run cargo build
  3. Cargo downloads source code for the specified versions of these crates form crates.io
  4. Based on Cargo.toml files, download their dependencies