Build Rust container images faster using layer caching

In the previous blog post I described how to define GitHub Actions pipeline to benefit from caching Rust dependencies and container images’ layers. But the final result may also depend on your Dockerfile. Namely, Docker Buildx Action supports BuildKit and buildx and in order to benefit from this, your Dockerfile has to explicitly cache layers. Actually, this is quite easy to achieve, let’s see the example: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 # syntax=docker/dockerfile:1....

2022-06-03 · 2 min · Boban Acimovic

How I speeded up my Rust builds on GitHub ~30 times

Rust is a great programming language, but it’s compiler is known to be slow. The main reason is that it checks so many things during the compilation in order to provides memory and concurrency safety. Like in many other cases, pipelines may be speeded up by caching, but it is very important to set the caching properly, otherwise it won’t help. Besides compiling your code may be slow, you also may want to use some cargo tools to lint and check your code and this will require to be compiled as well, if you don’t want to download binaries....

2022-05-18 · 5 min · Boban Acimovic

Parsing custom datetime format in Rust using serde

Most of the date and time related crates like time or chrono already implement serde traits making date or datetime parsing quite easy. This applies just if the format is standard, but what happens if the format is not standard? Let’s say we want to parse datetime looking like this 2021-10-24T07:48:26.389646Z. There is no timezone information so I decided to try the PrimitiveDateTime type from time crate. I didn’t consider using chrono at the moment because of the RUSTSEC-2020-0159 problem....

2021-10-24 · 2 min · Boban Acimovic

Parsing JSON in Rust easily explained

Parsing JSON in a proper way requires representing the JSON data in a structured format so that the language can find out which fields have to be parsed and which type they are. The Rust way of representing the structured data are so called structs . We could make appropriate structs manually, but thanks to the great online converter, transform.tools , we can generate the structs very easily. In this article we will parse data from songsterr....

2021-10-20 · 7 min · Boban Acimovic

A first impression of Rust from the perspective of a Go developer

In these uncertain times and multiple months of remote work, at least we have some more time to dive into something new. I have been developing in Go since 2017, learned some TypeScript in the meantime, but few days ago I wanted to get into Rust once again. First time, approximately a year ago I gave up very quickly, realizing that Rust requires lot of time to learn and I didn’t have that much time at the moment....

2020-12-26 · 3 min · Boban Acimovic