1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
//! # Actix is a rust actors framework.
//!
//! [Actors](https://actix.github.io/actix/actix/trait.Actor.html) are objects
//! which encapsulate state and behavior, they communicate exclusively
//! by exchanging messages. Actix actors are implemented on top of [Tokio](https://tokio.rs).
//! Multiple actors could run in same thread. Actors could run in multiple threads
//! with support of [`Arbiter`](https://actix.github.io/actix/actix/struct.Arbiter.html).
//! Actors exchange typed messages.
//!
//! ## Documentation
//!
//! * [User Guide](http://actix.github.io/actix/guide/)
//! * [Chat on gitter](https://gitter.im/actix/actix)
//! * [GitHub repository](https://github.com/actix/actix)
//! * [Cargo package](https://crates.io/crates/actix)
//! * Supported Rust version: 1.21 or later
//!
//! ## Features
//!
//! * Async/Sync actors.
//! * Actor communication in a local/thread context.
//! * Using Futures for asynchronous message handling.
//! * HTTP1/HTTP2 support ([actix-web](https://github.com/actix/actix-web))
//! * Actor supervision.
//! * Typed messages (No `Any` type). Generic messages are allowed.
//! * Minimum supported Rust version: 1.21 or later

#[macro_use]
extern crate log;
extern crate libc;
extern crate uuid;
extern crate smallvec;
extern crate crossbeam_channel;
#[macro_use]
extern crate bitflags;
#[macro_use]
extern crate futures;
extern crate tokio_io;
extern crate tokio_core;
extern crate tokio_signal;
extern crate trust_dns_resolver;

#[macro_use]
extern crate failure;

#[cfg_attr(feature="cargo-clippy", allow(useless_attribute))]
#[allow(unused_imports)]
#[macro_use]
extern crate actix_derive;

#[cfg(test)]
extern crate bytes;

#[doc(hidden)]
pub use actix_derive::*;

mod actor;
mod arbiter;
mod context;
mod contextimpl;
mod contextitems;
mod handler;
mod stream;
mod system;
mod supervisor;

mod address;
mod mailbox;

pub mod io;
pub mod fut;
pub mod actors;
pub mod msgs;
pub mod sync;
pub mod utils;
pub mod registry;

pub use fut::{ActorFuture, ActorStream, WrapFuture, WrapStream, FinishStream};
pub use actor::{Actor, ActorState, Supervised,
                ActorContext, AsyncContext, Running, SpawnHandle};
pub use handler::{Handler, Response, ActorResponse,
                  Message, MessageResult, ResponseFuture, ResponseActFuture};
pub use arbiter::Arbiter;
pub use address::{Addr, Syn, Unsync, ActorAddress, Recipient, MailboxError};
pub use context::Context;
pub use stream::StreamHandler;
pub use sync::{SyncContext, SyncArbiter};
pub use system::{System, SystemRunner};
pub use supervisor::Supervisor;

#[doc(hidden)]
pub use context::ContextFutureSpawner;

#[doc(hidden)]
#[deprecated(since="0.5.0", note="Use Addr<Unsync<T>>")]
pub type Address<T> = Addr<Unsync, T>;
#[doc(hidden)]
#[deprecated(since="0.5.0", note="Use Addr<Syn<T>>")]
pub type SyncAddress<T> = Addr<Syn, T>;

pub mod prelude {
//! The `actix` prelude
//!
//! The purpose of this module is to alleviate imports of many common actix traits
//! by adding a glob import to the top of actix heavy modules:
//!
//! ```
//! # #![allow(unused_imports)]
//! use actix::prelude::*;
//! ```

    #[doc(hidden)]
    pub use actix_derive::*;

    #[doc(hidden)]
    #[deprecated(since="0.5.0", note="Use Addr<Unsync<T>>")]
    pub type Address<T> = Addr<Unsync, T>;
    #[doc(hidden)]
    #[deprecated(since="0.5.0", note="Use Addr<Syn<T>>")]
    pub type SyncAddress<T> = Addr<Syn, T>;

    pub use fut::{ActorFuture, ActorStream, WrapFuture, WrapStream};
    pub use actor::{Actor, ActorState, ActorContext, AsyncContext,
                    Running, Supervised, SpawnHandle};
    pub use arbiter::Arbiter;
    pub use address::{Addr, Syn, Unsync, SendError, Recipient, MailboxError};
    pub use context::{Context, ContextFutureSpawner};
    pub use registry::{ArbiterService, SystemService};
    pub use stream::StreamHandler;
    pub use handler::{Handler, Response, ActorResponse, Message, MessageResult,
                      ResponseFuture, ResponseActFuture};
    pub use system::System;
    pub use sync::{SyncContext, SyncArbiter};
    pub use supervisor::Supervisor;

    pub mod actix {
        pub use prelude::*;
        pub use fut;
        pub use dev;
        pub use msgs;
        pub use io;
        pub use actors;
        pub use address::ActorAddress;
        pub use registry::{ArbiterService, SystemService};
        pub use utils::Condition;
    }
}

pub mod dev {
//! The `actix` prelude for library developers
//!
//! The purpose of this module is to alleviate imports of many common actix traits
//! by adding a glob import to the top of actix heavy modules:
//!
//! ```
//! # #![allow(unused_imports)]
//! use actix::dev::*;
//! ```

    pub use prelude::*;
    pub use prelude::actix::*;

    pub use contextimpl::ContextImpl;
    pub use handler::{MessageResponse, ResponseChannel};
    pub use address::{ActorAddress, ToEnvelope, SyncEnvelope,
                      Request, SyncRecipientRequest, UnsyncRecipientRequest};
    pub use address::{Destination, MessageDestination, MessageDestinationTransport, MessageRecipient};
}