Rust
Rust is a programming language designed for high performance and memory safety. It’s quite tricky to write, because the compiler is extremely picky for the sake of ensuring your code is correct.
I’ve never written it professionally, but I like it for building personal tools that I need to be fast, and as a way to try a language that’s different to what I normally write.
7 articles
Resizing images in Rust, now with EXIF orientation support
A new version of Rust’s image crate has support for EXIF orientation, which allows me to resize images without mangling their rotation.
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_cmdSome practical examples of how this handy crate lets me write clear, readable tests.
My (tiny) contribution to Rust 1.64
A suggestion for a better error message to help people who work in multiple languages.
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.
5 notes
My randline project is tested by Crater
I got a GitHub issue warning me that my project will break with a future version of Cargo.
Use
std::io::IsTerminalto 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.
Get a Palette colour as a command-line argument with Clap
Wrapping a
Palette:Srgbin a struct and implementingFromStrfor the struct allows you to take hexadecimal colours as command-line inputs.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.Rust macros are smarter than just text substitution
This is a safety feature that prevents macros expanding in an unexpected way.
