Expand description

thespis

standard-readme compliant Build Status Docs crates.io

Interface of the thespis actor model.

The interface of the thespis actor model (contains only traits). This defines the expected behavior for Addresses that can send to Actors, as well as the Handler trait and the Message trait.

There used to be a Mailbox trait, but it turns out that the mailbox is not depended on by any of the other components, so it’s iplementation can be freely changed without requiring an interface.

The purpose for the split between interface and implementation is 2-fold:

  1. Libraries can expose an actor based interface without having to depend on an implementation. Consumers can then choose any implementation they want and everything will remain inter-operable.
  2. Each component can be individually replaced and composed if you need a different behavior then the reference implementation.

The reference implementation can be found in the thespis_impl crate.

To get started with thespis, please check out the guide level documentation.

Table of Contents

Install

With cargo add: cargo add thespis

With cargo yaml:

dependencies:

   thespis: ^0.1

In Cargo.toml:

[dependencies]

   thespis = "0.1"

Upgrade

Please check out the changelog when upgrading.

Dependencies

This crate has few dependencies. Cargo will automatically handle it’s dependencies for you. Check Cargo.yml for the list of dependencies.

There is one optional feature, derive, enabled by default which adds proc macros for deriving the Message trait as well as removing some boilerplate when implementing Handler.

Security

This crate does not use unsafe, but it’s dependencies do.

Usage

Please refer to the thespis_impl crate to see examples of usage.

API

API documentation can be found on docs.rs.

Contributing

Please check out the contribution guidelines.

Testing

As this crate only provides traits, there aren’t any tests. You can check the thespis_impl crate for the tests.

Code of conduct

Any of the behaviors described in point 4 “Unacceptable Behavior” of the Citizens Code of Conduct are not welcome here and might get you banned. If anyone, including maintainers and moderators of the project, fail to respect these/your limits, you are entitled to call them out.

License

Unlicence

Traits

An actor is an isolated computing unit that runs concurrently to other actors. You must implement this trait as well as Handler to accept messages.

Behavior representing the capability of delivering a message to an actor’s mailbox.

Trait indicating that the implementor can receive messages of a certain type. An actor can implement Handler for as many types as desired.

Interface for uniquely identifying actors. Mainly useful for logging and debugging.

Indicates that a certain type can be sent as an actor message.

Re-export from the futures library.

Type Definitions

Shorthand for a boxed Address that is Send.

A boxed future that is Send, shorthand for async trait method return types.

A boxed future that is not Send, shorthand for async trait method return types.

Attribute Macros

Implement an async trait method for thespis traits.

Implement an async trait method for thespis traits.

Derive Macros

Generate a basic impl of Actor without any methods.