ref - https://doc.rust-lang.org/book/ch07-00-managing-growing-projects-with-packages-crates-and-modules.html

cargo add module_name

Cargo.toml

Screenshot 2025-02-21 at 3.52.25 PM.png

[package]
name = "rust"
version = "0.1.0"
edition = "2021"

[dependencies]
reqwest = "0.12.12"

Features in external crates

You can optionally get some features of an external crate if you dont need the full crate/need some extra features when installing the crate.

[dependencies]
reqwest = { version = "0.12.12", features = ["json"], }
serde = { version = "0.12.12", features = ["derive"] }

Try some packages locally

  1. chrono
  2. dotenv
  3. uuid
  4. tui
  5. thiserror
  6. sqlx

chrono

Chrono lets you do data and time in rust

https://docs.rs/chrono/latest/chrono

Screenshot 2025-02-21 at 4.19.20 PM.png

use chrono::{Local, Utc};

fn main() {
    let utc_time = Utc::now();
    let local_time = Local::now();
    println!("local time is {}", utc_time);
    println!("native time is {}", local_time);
}