Actix
Actor framework for Rust
[![crates.io](https://img.shields.io/crates/v/actix?label=latest)](https://crates.io/crates/actix)
[![Documentation](https://docs.rs/actix/badge.svg?version=0.13.5)](https://docs.rs/actix/0.13.5)
![Minimum Supported Rust Version](https://img.shields.io/badge/rustc-1.68+-ab6000.svg)
![License](https://img.shields.io/crates/l/actix.svg)
[![Dependency Status](https://deps.rs/crate/actix/0.13.5/status.svg)](https://deps.rs/crate/actix/0.13.5)
[![CI](https://github.com/actix/actix/actions/workflows/ci.yml/badge.svg)](https://github.com/actix/actix/actions/workflows/ci.yml)
[![codecov](https://codecov.io/gh/actix/actix/branch/master/graph/badge.svg)](https://codecov.io/gh/actix/actix)
![Downloads](https://img.shields.io/crates/d/actix.svg)
[![Chat on Discord](https://img.shields.io/discord/771444961383153695?label=chat&logo=discord)](https://discord.gg/GMuKN5b8aR)
## Documentation
- [User Guide](https://actix.rs/docs/actix)
- [API Documentation](https://docs.rs/actix)
## Features
- Async and sync actors
- Actor communication in a local/thread context
- Uses [futures](https://crates.io/crates/futures) for asynchronous message handling
- Actor supervision
- Typed messages (No `Any` type)
- Runs on stable Rust 1.68+
## Usage
To use `actix`, add this to your `Cargo.toml`:
```toml
[dependencies]
actix = "0.13"
```
### Initialize Actix
In order to use actix you first need to create a `System`.
```rust,ignore
fn main() {
let system = actix::System::new();
system.run();
}
```
Actix uses the [Tokio](https://github.com/tokio-rs/tokio) runtime. `System::new()` creates a new event loop. `System.run()` starts the Tokio event loop, and will finish once the `System` actor receives the `SystemExit` message.
### Implementing an Actor
In order to define an actor you need to define a struct and have it implement the [`Actor`](https://docs.rs/actix/latest/actix/trait.Actor.html) trait.
```rust
use actix::{Actor, Context, System};
struct MyActor;
impl Actor for MyActor {
type Context = Context