diff --git a/examples/local/src/application.rs b/examples/local/src/application.rs deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/examples/local/src/main.rs b/examples/local/src/main.rs index 1f49badda2e61647f59b9f31b8ef6c6760660f67..ecc1c387e2d201dbb54eb9c52bbce4cbe19bc040 100644 --- a/examples/local/src/main.rs +++ b/examples/local/src/main.rs @@ -1,6 +1,5 @@ use rust_networking_examples::Network; -mod application; mod net; use net::Net; @@ -15,6 +14,6 @@ async fn main() { net_a.send("b", "Hello world!".as_bytes().to_vec()); while let Some((from, msg)) = recv_b.recv().await { - println!("{}, {:?}", from, msg); + println!("Received {:?} from {}", String::from_utf8(msg), from); } } diff --git a/examples/local/src/net/dispatch.rs b/examples/local/src/net/dispatch.rs index 1bd19b0efa6c9cd8b263424928d3aa8063afb799..0f2d8f65957a646814066e4a679c8cbe417c85c7 100644 --- a/examples/local/src/net/dispatch.rs +++ b/examples/local/src/net/dispatch.rs @@ -67,10 +67,13 @@ impl DispatchHandle { } } +/// Represents a collection of channels that we can dispatch messages through +type DispatchChannels = Vec<mpsc::Sender<(String, Vec<u8>)>>; + /// The dispatch actor itself, that performs message routing. #[derive(Default)] struct Actor { - senders: HashMap<String, Vec<mpsc::Sender<(String, Vec<u8>)>>> + senders: HashMap<String, DispatchChannels> } impl Actor {