Crate actix

source ·
Expand description

Actix is a rust actors framework.

Actors are objects which encapsulate state and behavior, they communicate exclusively by exchanging messages. Actix actors are implemented on top of Tokio. Multiple actors could run in same thread. Actors could run in multiple threads with support of Arbiter. Actors exchange typed messages.

Documentation

Features

  • Async/Sync actors.
  • Actor communication in a local/thread context.
  • Using Futures for asynchronous message handling.
  • HTTP1/HTTP2 support (actix-web)
  • Actor supervision.
  • Typed messages (No Any type). Generic messages are allowed.

Package feature

  • resolver - enables dns resolver actor, actix::actors::resolver
  • signal - enables signals handling actor

Tokio runtime

At the moment actix uses current_thread runtime.

While it provides minimum overhead, it has its own limits:

  • You cannot use tokio’s async file I/O, as it relies on blocking calls that are not available in current_thread
  • Stdin, Stderr and Stdout from tokio::io are the same as file I/O in that regard and cannot be used in asynchronous manner in actix.

Re-exports

pub use fut::ActorFuture;
pub use fut::ActorStream;
pub use fut::WrapFuture;
pub use fut::WrapStream;
pub use registry::ArbiterService;
pub use registry::Registry;
pub use registry::SystemRegistry;
pub use registry::SystemService;
pub use sync::SyncArbiter;
pub use sync::SyncContext;

Modules

Helper actors
A configurable source of time.
The actix prelude for library developers
Custom Future implementation with Actix support
Actix system messages
The actix prelude
Actors registry
Sync actors support

Structs

Helper type for representing different type of message responses
Address of the actor
Event loop controller
Actor execution context
Helper type that implements MessageResponse trait
Recipient type allows to send one specific message to an actor.
Helper type for representing different type of message responses
Spawned future handle. Could be used for cancelling spawned future.
Actor supervisor
System is an actor which manages runtime.
Helper object that runs System’s event loop

Enums

Actor execution state
Set of error that can occurred during message delivery process

Traits

Actors are objects which encapsulate state and behavior.
Actor execution context
Asynchronous execution context
Message handler
Message type
Stream handler
Actors with ability to restart after failure

Functions

Start the System and execute supplied future.
Spawns a future on the current arbiter.

Type Definitions

A specialized actor future for async message handler
A specialized future for async message handler