Genserver: Elixir-inspired actors

Hey Rustaceans,

One of my favourite things about Elixir is the GenServer abstraction. If you've used Elixir or Erlang before, you're likely familiar with its concurrency model and how powerful it can be. I wanted something similar for Rust, but couldn't really find an abstraction I liked.

It's tricky to emulate some of the features of OTP in Rust, but we can get close with the help of Tokio and procedural macros.

I've made a crate called genserver which provides an API similar to that of Elixir's GenServer. The library is based around one trait (called GenServer) and an attribute macro that generates an object (a registry) for creating and managing the servers you define.

You can pass messages between your servers with 3 different kinds of calls: blocking, blocking with a timeout, and non-blocking (call, call w/ timeout, and cast). It's a simple but very powerful abstraction for building async services.

Anyway, hope someone finds this useful.