|
4 | 4 | //!
|
5 | 5 | //! Actors are processing units that interact using asynchronous messages.
|
6 | 6 | //!
|
7 |
| -//! The behavior of an [Actor](crate::Actor) is defined by: |
| 7 | +//! The behavior of an [Actor] is defined by: |
8 | 8 | //! - a state owned and freely updated by the actor,
|
9 | 9 | //! - a [message box](crate::message_boxes) connected to peer actors,
|
10 | 10 | //! - input [messages](crate::Message) that the actor receives from its peers and processes in turn,
|
|
87 | 87 | //! ```
|
88 | 88 | //!
|
89 | 89 | //! This crate provides specific `Actor` implementations:
|
90 |
| -//! - The [ServerActor](crate::ServerActor) wraps a [Server](crate::Server), |
| 90 | +//! - The [ServerActor] wraps a [Server], |
91 | 91 | //! to implement a request-response communication pattern with a set of connected client actors.
|
92 |
| -//! - The [ConvertingActor](crate::ConvertingActor) wraps a [Converter](crate::Converter), |
| 92 | +//! - The [ConvertingActor] wraps a [Converter], |
93 | 93 | //! that translates each input message into a sequence of output messages.
|
94 | 94 | //!
|
95 | 95 | //! ## Testing an actor
|
|
104 | 104 | //! [Actor and message box builders](crate::builders) are provided to address these specificities
|
105 | 105 | //! with a generic approach without exposing the internal structure of the actors.
|
106 | 106 | //!
|
107 |
| -//! To test the `Calculator` example we need first to create its box using a |
108 |
| -//! [SimpleMessageBoxBuilder](crate::SimpleMessageBoxBuilder), |
109 |
| -//! as this actor expects a [SimpleMessageBox](crate::SimpleMessageBox). |
| 107 | +//! To test the `Calculator` example we need first to create its box using a [SimpleMessageBoxBuilder], |
| 108 | +//! as this actor expects a [SimpleMessageBox]. |
110 | 109 | //! And then, to create a test box connected to the actor message box,
|
111 | 110 | //! we use the [ServiceProviderExt](crate::test_helpers::ServiceProviderExt) test helper extension
|
112 | 111 | //! and the [new_client_box](crate::test_helpers::ServiceProviderExt::new_client_box) method.
|
|
153 | 152 | //! # }
|
154 | 153 | //! ```
|
155 | 154 | //!
|
156 |
| -//! See the [test_helpers](crate::test_helpers) module for various ways |
| 155 | +//! See the [test_helpers] module for various ways |
157 | 156 | //! to observe and interact with running actors.
|
158 | 157 | //!
|
159 | 158 | //! - The primary tool to interact with an actor under test is the [SimpleMessageBoxBuilder],
|
|
172 | 171 | //! that define the services provided and consumed by the actors under construction.
|
173 | 172 | //!
|
174 | 173 | //! The connection builder traits work by pairs.
|
175 |
| -//! A [MessageSink](crate::MessageSink) connects to a [MessageSource](crate::MessageSource), |
| 174 | +//! A [MessageSink] connects to a [MessageSource], |
176 | 175 | //! so the messages sent by the latter will be received by the former.
|
177 | 176 | //!
|
178 | 177 | //! These traits define the types of the messages sent and received.
|
179 | 178 | //! - A sink that excepts message of type `M` can only be connected to a source of messages
|
180 | 179 | //! that can be converted into `M` values.
|
181 |
| -//! - Similarly a service is defined by two types of messages, the requests received by the service |
182 |
| -//! and the responses sent by the service. To use a service, a consumer will have to send messages |
183 |
| -//! that can be converted into the service request type and be ready to receive messages converted from |
184 |
| -//! the service response type. |
185 | 180 | //! - Note, that no contract is enforced beyond the type-compatibility of the messages sent between the actors.
|
186 | 181 | //! A consumer of an HTTP service needs to known that a request must be sent before any response can be received;
|
187 | 182 | //! while a consumer of an MQTT service can expect to receive messages without sending a single one.
|
188 | 183 | //!
|
189 | 184 | //! The connection builder traits also define a configuration type.
|
190 |
| -//! - The semantics of this type is defined by the message source or the service provider. |
191 |
| -//! It can be used to filter the values sent to a given sink |
192 |
| -//! or to restrict the scope of the service provided to a given service consumer. |
193 |
| -//! - The configuration values are provided by the message sinks and the service consumers |
194 |
| -//! to specify the context of their connection to a source or a service. |
| 185 | +//! - The semantics of this type is defined by the message source and is used to filter the values sent to a sink. |
| 186 | +//! - The actual configuration values are provided by the actor sinks when connecting the source |
| 187 | +//! to specify the subset of messages their are interested into. |
195 | 188 | //!
|
196 | 189 | //! Note that these traits are implemented by the actor builders, not by the actors themselves.
|
197 | 190 | //!
|
|
0 commit comments