Skip to content

Commit b9231fd

Browse files
committed
echo example: switch order of Delay and Damper
Thanks to the previous commit, this is now possible to do this _without touching the actors themselves._ Artificial change for demonstration purposes. This brings no change functionality-wise.
1 parent 502b7f2 commit b9231fd

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

examples/echo.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
//! +---> Mixer +-+
1313
//! +------> +--------+
1414
//! | +-------+ |
15-
//! +--------+ +---v---+
16-
//! | Damper <--------------+ Delay |
17-
//! +--------+ +-------+
15+
//! +--------+ +---v----+
16+
//! | Delay <--------------+ Damper |
17+
//! +--------+ +--------+
1818
1919
use actor::{Actor, Addr, Context, Recipient, System};
2020
use anyhow::Error;
@@ -270,15 +270,15 @@ fn main() -> Result<(), Error> {
270270
// Create Mixer address explicitly in order to break the circular dependency loop.
271271
let mixer_addr = Addr::default();
272272

273-
// Damper feeds back into Mixer.
274-
let damper_addr = system.spawn(Damper { next: mixer_addr.recipient() })?;
273+
// Delay feeds back into Mixer.
274+
let delay_addr = system.spawn(Delay::new(mixer_addr.recipient()))?;
275275

276-
// Delay effect goes into Damper.
277-
let delay_addr = system.spawn(Delay::new(damper_addr.recipient()))?;
276+
// Damper goes into Delay effect.
277+
let damper_addr = system.spawn(Damper { next: delay_addr.recipient() })?;
278278

279279
// We can finally spawn the Mixer. Feeds into Output and Delay effect.
280280
system.spawn_fn_with_addr(
281-
move || Mixer::new(output_addr.recipient(), delay_addr.recipient()),
281+
move || Mixer::new(output_addr.recipient(), damper_addr.recipient()),
282282
mixer_addr.clone(),
283283
)?;
284284

0 commit comments

Comments
 (0)