A month or so ago I started working on a neural network implementation in Rust, from scratch. I wasn’t interested in achieving the best performance, or having all the bells and whistles. I had a simple goal of understanding NEAT. For those of you that are not familiar with it, here’s a snippet…

While getting my degree in Physics, I had to take classes in both MatLab and Python for scientific computing. I preferred python, where we used the SciPy and NumPy packages. In fact, I used those packages again (along with matplotlib) in an undergraduate research project simulating bacteria films. There’s a catch: I was also pursuing a degree in Computer Science, and Python just wasn’t fast enough for that side of me, so, during my free time in graduate school, I rewrote my biofilm simulation in my new favorite language, Rust.

Read More

I just finished implementing a non-trivial bit of Pijul: cross-process locks for Sanakirja databases. In this post, I explain how it works.

Rust is an amazing language. It has enabled excellent CLI tools like ripgrep and exa. Companies like Cloudflare are using Rust for their own systems and encouraging people to write Rust to run microservices. Rust makes it possible to write really fast software that’s secure, tiny, and more concise than C++ or C.

If I were writing a geocoder, a routing engine, a real-time messaging platform, a database, or a CLI tool, Rust would be at the top of the list.

But last year, I spent some time trying to make Rust work for a plain-vanilla API to power a normal website. It wasn’t a very good fit.

Read More

I’ve been writing a DNS implementation in Rust. This project started out as a vehicle for learning Rust, but the more I learned, the more challenging goals I was able to set, to the point where I can see its potential to become useful in its own right. Here’s a post about what I’ve learned so far while writing nonymous, an embedded-friendly DNS library with #![no_std] and no-alloc support, and bore(1), a CLI tool for sending DNS queries.

In this post, we pick up where we left off with attribute getters, and expand into method calls. In some ways, the same techniques we used for attributes work just as well here. We can store a map from method name to functions implementing them. However, there’s a curveball: the Rust Fn* traits. We’ll talk through the wrong turns we took, and the tidbits of Rust knowledge we picked up along the way.

In Rust, changes to a type’s size are not usually understood to be Breaking Changes™. Of course, that isn’t to say you can’t break safe downstream code by changing the size of a type…

One user of the signal-hook crate expressed an interest in knowing the PID and UID of the process that sent the signal. As a general idea I liked it. The low-level sigaction does indeed provide this information and it might be useful (more than once I have wondered why the program terminated because someone sent it a SIGTERM, but the logs contained no information about what other process it was; knowing its PID is the first step to figuring it out, though I don’t know of a nice portable way to convert a PID to a name of a process or something of similar usability). In fact, I had a long-standing open issue on the repository about being able to somehow make the additional information in the siginfo_t structure available.

So I’ve decided to give it a go and implement it. In fact, I’ve already had the place in the API this would plug in that would make it immediately available to all the signal-hook-* asynchronous add-ons too, not only the iterator inside signal-hook.

For a few reasons, this turned out to be a bigger challenge than I expected.

Read More

In this series we’ll create a simulation of evolution using neural network & genetic algorithm.

I’m going to introduce you to how a basic neural network and genetic algorithm works, then we’ll implement both in Rust and compile our application to WebAssembly to ultimately end up with:

When developing programs, we have to solve many problems. A program can be viewed as a solution to a problem. It can also be viewed as a collection of solutions to many different problems. All of these solutions work together to solve a bigger problem.

There are many problems that share the same form. Due to the fact that Rust is not object-oriented design patterns vary with respect to other object-oriented programming languages. While the details are different, since they have the same form they can be solved using the same fundamental methods.

Read More

Artichoke is a Ruby implementation written in Rust and Ruby. Artichoke intends to be MRI-compatible and targets Ruby 2.6.3. Artichoke provides a Ruby runtime implemented in Rust and Ruby.

Tectonic is a modernized, complete, self-contained TeX/LaTeX engine, powered by XeTeX and TeXLive.

Dec 31, 2020

The Rust team is happy to announce a new version of Rust, 1.49.0. Rust is a programming language that is empowering everyone to build reliable and efficient software.

Dec 30, 2020

I’ve got an announcement to make. As of Jan 4th, I’m starting at Amazon as the tech lead of their new Rust team. Working at Mozilla has been a great experience, but I’m pretty excited about this change. It’s a chance to help shape what I hope to be an exciting new phase for Rust, where we grow from a project with a single primary sponsor (Mozilla) to an industry standard, supported by a wide array of companies. It’s also a chance to work with some pretty awesome people – both familiar faces from the Rust community1 and some new folks. Finally, I’m hoping it will be an opportunity for me to refocus my attention to some long-standing projects that I really want to see through.

Read More
Dec 29, 2020

This post documents call site dependency injection pattern. It is a rather low level specimen and has little to do with enterprise DI. The pattern is somewhat Rust-specific.

Dec 29, 2020

This semi-surprising corner case came up in some recent Rust training I was giving. I figured a short write-up may help some others in the future.

Rust’s language design focuses on ergonomics. The goal is to make common patterns easy to write on a regular basis. This overall works out very well. But occasionally, you end up with a surprising outcome. And I think this situation is a good example.

rust

A place to discuss, share, love, hate and meme about rust.

Created on Jun 17, 2020
By @gurlic