2 releases

new 0.0.1 Apr 21, 2024
0.0.0 Feb 26, 2024

#23 in #polymorphism

Used in shakespeare




Shakespeare is an actor framework written in Rust that focuses on ergonomics and extensibility while maintaining high performance.

Its most significant differences from existing frameworks include:

  • polymorphic actors - actors' interfaces are a first-class consideration in shakespeare, and allowing code to work over dynamically chosen actors is a primary use case
  • rich interfaces - a single interface for an actor can support any number of methods with no more boilerplate than the equivalent trait definition
  • code generation - the majority of functionality is implemented by procedural macros, both minimizing direct runtime overhead and offering more visibility to the optimizer.


use tokio::sync::mpsc::*;

mod Actor {
    struct ActorState {
        sender: UnboundedSender<usize>,
    impl BasicRole for ActorState {
        fn speak(&mut self, val: usize) {

async fn main() {
    let (sender, mut recv) = tokio::sync::mpsc::unbounded_channel();
    let state = ActorState { sender };
    let shakespeare::ActorSpawn { actor, .. } = ActorState::start(state);
    actor.speak(42).await.expect("Error sending");
    assert_eq!(recv.recv().await.unwrap(), 42);


Licensed under either of Apache Licence, Version 2.0 or MIT licence at your option.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 licence, shall be dual licensed as above, without any additional terms or conditions.


~36K SLoC