← See all notes

Table of Contents

Rust

Crates 🔗

Using mold as the linker 🔗

[target.aarch64-apple-darwin]
rustflags = ["-C", "link-arg=-fuse-ld=/opt/homebrew/bin/ld64.mold"]

Scripts in Rust 🔗

#!/usr/bin/env -S cargo +nightly -Zscript
---cargo
[package]
edition = "2024"
[dependencies]
reqwest = { version = "0.12" }
tokio = { version = "1", features = ["full"] }
---

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
  let data = reqwest::get("https://httpbin.org/headers")
    .await?
    .text()
    .await?;

  print!("{}", data);
  Ok(())
}