Posts with tag

Gtk-rs: how to have mutable object in a closure?

In the previous post The Ulam spiral in Rust I described application that generates prime numbers spiral. I have chosen gtk-rs to write the user interface, because of the pretty good documentation and examples in the repository. If something is not documented there, you can easily check the original Gtk library written in C, which was a base for the Rust version. Also, I just like Gtk, no big story ...

Read more...

The Ulam spiral in Rust

I'd like to share some thoughts about a specific mathematical phenomenon related to the prime numbers and tiny piece of software to generate visual representation of it.

What is specific about prime numbers?

Prime numbers are special subset of natural numbers. A prime number (or a prime as we'll call them) can be divided by 1 or by itself only, leaving no remainder. This simple definition is what ...

Read more...

Implementing Huffman algorithm in Rust 🤔

Well, in the beginning I have to confess that I thought that this task will be easy enough to complete it within few hours max. It turned out that I spent a way more. Really a lot. Enough to say that I discovered what is all this hassle with "fighting borrow checker" about.

What was my goal?

My goal was to implement Huffman coding algorithm as in this example: https ...

Read more...

How to organize tests in Rust?

rust

Recently I begun to play with Rust - a promising, multi paradigm programming language, that looks similar to C family at first glance, but turns out to be something way more interesting.

At the same time I was obsessed with TDD (test-driven development) methodology and wanted to write used it in a Rust project. However, I encountered some problems with organizing the test directories in my Rust. We'll be investigating ...

Read more...