Checkpoint reproduction for rust-lang/rust#68372

This commit is contained in:
R Tyler Croy 2020-01-19 11:04:36 -08:00
parent 906aa2bc65
commit d837eb8af1
No known key found for this signature in database
GPG Key ID: E5C92681BEF6CEA2
1 changed files with 8 additions and 21 deletions

View File

@ -14,30 +14,17 @@ use tokio::sync::broadcast::{channel, Receiver, Sender};
/**
* A channel is named and typed with the type of messages it should be carrying
*/
struct ChannelV<T> {
struct Channel {
name: String,
send: Sender<T>,
recv: Receiver<T>,
send: Sender<Message>,
recv: Receiver<Message>,
}
struct StringChannel {
name: String,
send: Sender<String>,
recv: Receiver<String>,
}
struct SM(String);
impl Message for SM {}
struct Message {}
impl Channel<SM> for StringChannel {
fn send(&self, msg: SM) {}
fn recv(&self, msg: SM) {}
}
trait Message {}
trait Channel<T> {
fn send(&self, msg: impl Message);
fn recv(&self, msg: impl Message);
impl Channel {
fn send(&self, msg: Message) {}
fn recv(&self, msg: Message) {}
}
struct Bus {
@ -46,7 +33,7 @@ struct Bus {
* allow the Bus to handle different channels with different message payloads
* while still taking advantage of compile-time checks
*/
channels: HashMap<String, Box<Channel<Message>>>,
channels: HashMap<String, Channel>,
}
#[cfg(test)]