# Actor12 Framework
[](https://docs.rs/actor12)
A lightweight, high-performance actor framework for Rust built on Tokio. This is a standalone version of the actor system extracted from the Runy project.
## Features
- **Type-safe messaging**: Strongly typed actor messages with compile-time guarantees
- **Async/await support**: Built on Tokio for efficient async message handling
- **Cancellation**: Hierarchical cancellation system for clean shutdown
- **Memory tracking**: Built-in memory usage tracking for actors
- **Flexible channels**: Support for different message channel types
## Quick Start
Add this to your `Cargo.toml`:
```toml
[dependencies]
actor12 = "0.0.4"
tokio = { version = "1", features = ["full"] }
anyhow = "1.0"
futures = "0.3"
```
For complete examples and API documentation, see the [documentation](https://docs.rs/actor12).
## Examples
Run the examples to see the framework in action:
### Basic Examples
```bash
# Simple echo server
cargo run --example echo_server
# Counter with state management
cargo run --example simple_counter
```
### Handler Pattern Examples
```bash
# Multiple message types with Handler trait
cargo run --example handler_pattern
# Dynamic dispatch and routing
cargo run --example dynamic_dispatch
```
### Advanced Examples
```bash
# Ping-pong between actors (see examples/ directory)
cargo run --example ping_pong
# Bank account with transactions
cargo run --example bank_account
# Worker pool pattern
cargo run --example worker_pool
```
## Core Concepts
The Actor12 framework is built around several key concepts:
- **Actors**: Isolated units of computation with their own state
- **Messages**: Type-safe communication via `Envelope<T, R>` or `Handler<M>` patterns
- **Links**: Thread-safe handles for sending messages to actors
- **Cancellation**: Hierarchical shutdown system for clean resource management
For detailed explanations and examples, see the [API documentation](https://docs.rs/actor12).
## Testing
```bash
cargo test
```
## License
This project inherits the license from the original Runy project.