Tags » rust
-
randline: get a random selection of lines in a file using reservoir sampling
I wrote a tiny Rust tool to get random samples in a memory-efficient way, and I learnt a lot while doing it.
-
How I test Rust command-line apps with
assert_cmd
Some practical examples of how this handy crate lets me write clear, readable tests.
-
TIL: Use
std::io::IsTerminal
to detect if you’re running in the terminal in RustThis allows me to suppress ANSI escape codes if the output is going somewhere other than the terminal.
-
TIL: Get a Palette colour as a command-line argument with Clap
Wrapping a
Palette:Srgb
in a struct and implementingFromStr
for the struct allows you to take hexadecimal colours as command-line inputs. -
My (tiny) contribution to Rust 1.64
A suggestion for a better error message to help people who work in multiple languages.
-
TIL: How to use hex colours with the palette crate
You can use
Srgb::from_str()
to parse a hexadecimal string as a colour in the palette crate. -
Running a Rust binary in Glitch
Using different targets to build Rust binaries that will run in Glitch.
-
Creating coloured bookshelf graphics in Rust
Explaining some code that draws coloured rectangles in a way that looks a bit like an upside-down bookshelf.
-
The ever-improving error messages of Rust
An improvement to Rust’s error handling that I almost reported, until I realised it was fixed.
-
Backing up full-page archives from Pinboard
A Rust utility for saving local copies of my full-page archives from Pinboard.