diff --git a/src/replies.rs b/src/replies.rs index 59ffb58..8d3cd91 100644 --- a/src/replies.rs +++ b/src/replies.rs @@ -49,8 +49,7 @@ pub struct Replies { pending: HashMap>, } -// TODO Relax bounds -impl Replies { +impl Replies { pub fn new(timeout: Duration) -> Self { Self { timeout, @@ -62,7 +61,10 @@ impl Replies { self.timeout } - pub fn wait_for(&mut self, id: I) -> PendingReply { + pub fn wait_for(&mut self, id: I) -> PendingReply + where + I: Eq + Hash, + { let (tx, rx) = oneshot::channel(); self.pending.insert(id, tx); PendingReply { @@ -71,7 +73,10 @@ impl Replies { } } - pub fn complete(&mut self, id: &I, result: R) { + pub fn complete(&mut self, id: &I, result: R) + where + I: Eq + Hash, + { if let Some(tx) = self.pending.remove(id) { let _ = tx.send(result); }