I'm working on a new site at https://highperformancewebfonts.com/ where I'm doing everything wrong. E.g. using a joke-y client-side-only rendering of articles from .md files (Hello Lizzy.js)
Since there's no static generation, there was no RSS feed. And since someone asked, I decided to add one. But in the spirit of learning-while-doing, I thought I should do the feed generation in Rust—a language I know nothing about.
Here are my first steps in Rust, for posterity. BTW the end result is https://highperformancewebfonts.com/feed.xml
rustup tool. This page https://www.rust-lang.org/tools/install has the instructions:$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Next, restart the terminal shell or run:
$ . "$HOME/.cargo/env"
Check if installation was ok:
$ rustc --versionrustc 1.84.0 (9fc6b4312 2025-01-07)
2. A new projectA tool called Cargo seems like the way to go. Looks like it's a package manager, an NPM of Rust:
$ cargo new russel && cd russel
(The name of my program is "russel", from "rusty", from "rust". Yeah, I'll see myself out.)
Cargo.toml looks like a config file similar in spirit to package.json and similar in syntax to a php.ini. Since I'll need to write an RSS feed, a package called rss would be handy.[package]name = "russel"version = "0.1.0"edition = "2021"[dependencies]rss = "2.0.0"
Running $ cargo build after a dependency update seems necessary.
To explore packages, a crates.io site looks appropriate e.g. https://crates.io/crates/rss as well as docs.rs, e.g. https://docs.rs/rss/2.0.11/rss/index.html
cargo new russel from the previous step created a hello-world program. We can test it by running:$ cargo run
This should print "Hello, world!"
Nice!
Open src/main.rs, look at this wonderful function:
fn main() { println!("Hello, world!");}
Replace the string with "Bello, world". Save. Run:
$ cargo run
If you see the "Bello", the setup seems to be working. Rejoice!
Go Rust in peace!https://en.wikipedia.org/wiki/Rust_in_Peace