Articles tagged #rust
One funny way to bundle assets
There’s one thing that bothers me. In part 1, why are we using
hyper-staticfile
? Couldn’t we just use file:///
URLs?
Well, first off: showing off how easy it is to serve some static files, even in a “scary” language like Rust, is just not something I could pass up.
But also: think about distributing salvage
as a tool. Will we want to
distribute all those HTML/CSS/JS/font files alongside it?
The rest of the fucking owl
NO! No no no.
What?
WE WERE DONE!
Well… yes! But also no. We still shell out to a bunch of tools:
$ rg 'Command::new'
src/commands/mod.rs
126: let variant = if let Ok(output) = run_command(Command::new("wslpath").arg("-m").arg("/")) {
src/commands/cavif.rs
29: Command::new("cavif")
src/commands/imagemagick.rs
25: Command::new(&self.bin)
src/commands/cwebp.rs
25: Command::new("cwebp")
src/commands/svgo.rs
25: Command::new("svgo")
Productionizing our poppler build
I was a bit anxious about running our poppler meson build in CI, because it’s the real test, you know? “Works on my machine” only goes so far, things have a tendency to break once you try to make them reproducible.
And I was right to worry… but not for the reasons I thought. As I tried to get everything to build in CI, there was a Pypi maintenance that prevented me from installing meson, and then Sourceforge was acting up.
From Inkscape to poppler
What’s next? Well… poppler is the library Inkscape uses to import PDFs.
Yes, the name comes from Futurama.
Turns out, poppler comes with a bunch of CLI tools, including pdftocairo
!
Halfway through this article, I realized the “regular weight” on my system was in fact Iosevka SS01 (Andale Mono Style) (see Releases), but the “bold weight” was the default Iosevka.
Why is my Rust build so slow?
I’ve recently come back to an older project of mine (that powers this website), and as I did some maintenance work: upgrade to newer crates, upgrade to a newer rustc, I noticed that my build was taking too damn long!
For me, this is a big issue. Because I juggle a lot of things at any given time, and I have less and less time to just hyperfocus on an issue, I try to make my setup as productive as possible.
My ideal Rust workflow
Writing Rust is pretty neat. But you know what’s even neater? Continuously testing Rust, releasing Rust, and eventually, shipping Rust to production. And for that, we want more than plug-in for a code editor.
We want… a workflow.
Why I specifically care about this
This gets pretty long, so if all you want is the advice, feel free to jump to it directly.
A terminal case of Linux
Has this ever happened to you?
You want to look at a JSON file in your terminal, so you pipe it into jq so you can look at it with colors and stuff.
That’s a useless use of cat.
…oh hey cool bear. No warm-up today huh.
Sure, fine, okay, I’ll read the darn man page for jq
… okay it takes
a “filter” and then some files. And the filter we want is.. .
which, just
like files, means “the current thing”:
Go back to the homepage.