From a401e5fcd1c0e2e3d2da38045ec64604caba1526 Mon Sep 17 00:00:00 2001 From: Tony Garnock-Jones Date: Mon, 4 Mar 2024 10:11:17 +0100 Subject: [PATCH] A little fairer --- syndicate-macros/examples/tokio-ring.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/syndicate-macros/examples/tokio-ring.rs b/syndicate-macros/examples/tokio-ring.rs index 480eedb..c431cfb 100644 --- a/syndicate-macros/examples/tokio-ring.rs +++ b/syndicate-macros/examples/tokio-ring.rs @@ -5,7 +5,7 @@ use std::sync::atomic::Ordering; use tokio::sync::mpsc::{unbounded_channel, UnboundedSender}; -type Ref = UnboundedSender; +type Ref = UnboundedSender>; #[derive(Debug)] enum Instruction { @@ -35,14 +35,14 @@ trait Actor { } fn send(ch: &Arc>, message: T) -> () { - match ch.send(message) { + match ch.send(Box::new(message)) { Ok(()) => (), Err(v) => panic!("Aiee! Could not send {:?}", v), } } fn spawn + std::marker::Send + 'static>(rt: Option>, mut ac: R) -> Arc> { - let (tx, mut rx) = unbounded_channel(); + let (tx, mut rx) = unbounded_channel::>(); if let Some(ref c) = rt { c.fetch_add(1, Ordering::SeqCst); } @@ -51,7 +51,7 @@ fn spawn + std::marker::Send + 'stat match rx.recv().await { None => break, Some(message) => { - match ac.message(message) { + match ac.message(*message) { Action::Continue => continue, Action::Stop => break, }