Member-only story

Actor-Model Systems in Rust with Abstraction!

Ryan Deschamps
6 min readSep 4, 2024

--

All the World’s a stage and each actor must play its part.

I am an educator first and foremost. Since they say “those who cannot do, teach” I sometimes like to buck that trend and just do. Throw caution to the wind. These days, a good number of my students want to ask me about Rust (other things too, but Rust is one). I had heard good things about Rust, and also bad, such as the learning curve. But if one thing a teacher can do is learn. For this reason, I decided to looking into Actor-Model Systems.

In my first bit of research, I came upon a few frameworks, but for a variety of reasons, possibly related to ego, I rejected them all. Besides just being set in my ways, I realized that many of the existing solutions were using the popular Tokio framework to build their libraries. Tokio already had many of the asynchronous tools that I would need to build the system, so why would I want to work with someone else’s language just to do the things I have always done? That’s why I went with my own custom example, just to prove that it can be done.

An actor-model system is a system of structures, usually classes (although hold that thought because Rust will be different), that do work inside their own thread. The work can be anything you want. It could be to collect data from a stream somewhere on the internet, to clean data, to apply a data model to some input, to parse an input into some kind of chat…

--

--

Ryan Deschamps
Ryan Deschamps

Written by Ryan Deschamps

College professor covering just about everything tech and policy.

No responses yet