24 days of Rust - image

Important note: this article is outdated! Go to http://zsiciarz.github.io/24daysofrust/ for a recent version of all of 24 days of Rust articles. The blogpost here is kept as it is for historical reasons.

The image crate is a library under development (well, not unlike the rest of the Rust ecosystem before 1.0) to read, manipulate and write images. It is part of the effort to develop an open source game engine in pure Rust - Piston, but of course the image crate can be used on its own.

At the moment image supports reading and writing JPG and PNG images, while a few other formats are read-only (GIF, TIFF, WEBP).

Continue reading »
Written on Dec. 12, 2014

24 days of Rust - postgres

Important note: this article is outdated! Go to http://zsiciarz.github.io/24daysofrust/ for a recent version of all of 24 days of Rust articles. The blogpost here is kept as it is for historical reasons.

Yes, I'm biased. PostgreSQL is my favorite SQL database and the upcoming 9.4 release makes me even more excited. There is already a pure Rust driver for PostgreSQL - the postgres crate which will be the subject of today's article.

Continue reading »
Written on Dec. 11, 2014

24 days of Rust - the glorious tau

Important note: this article is outdated! Go to http://zsiciarz.github.io/24daysofrust/ for a recent version of all of 24 days of Rust articles. The blogpost here is kept as it is for historical reasons.

τ (tau) is one of the most important mathematical constants (if not the most important), relating circle's circumference to it's radius. See the tau manifesto for the long explanation if you're still an unbeliever. Can we use it in Rust? Of course, there's a crate for that!

Continue reading »
Written on Dec. 10, 2014

24 days of Rust - anymap

Important note: this article is outdated! Go to http://zsiciarz.github.io/24daysofrust/ for a recent version of all of 24 days of Rust articles. The blogpost here is kept as it is for historical reasons.

In this article we will focus on the anymap crate by Chris Morgan of rust-http and teepee fame. This crate provides the AnyMap type - a slightly peculiar, interesting container.

The AnyMap type is different from a regular map. For example, a HashMap in Rust is a generic type parametrized by K - the type of keys and V - the type of values stored in map. (There's also a hasher parameter, but it's not relevant here.) Meanwhile, AnyMap itself is not a generic type. It uses a HashMap internally but we don't need to know that; conceptually, AnyMap maps from types to values. This means that for each and every type there can be at most one value contained in the mapping.

Continue reading »
Written on Dec. 9, 2014