Rewrite conn module
This commit is contained in:
parent
470f3455f7
commit
6916977a47
6 changed files with 328 additions and 335 deletions
|
|
@ -49,6 +49,7 @@ pub struct Replies<I, R> {
|
|||
pending: HashMap<I, Sender<R>>,
|
||||
}
|
||||
|
||||
// TODO Relax bounds
|
||||
impl<I: Eq + Hash, R> Replies<I, R> {
|
||||
pub fn new(timeout: Duration) -> Self {
|
||||
Self {
|
||||
|
|
@ -57,6 +58,10 @@ impl<I: Eq + Hash, R> Replies<I, R> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn timeout(&self) -> Duration {
|
||||
self.timeout
|
||||
}
|
||||
|
||||
pub fn wait_for(&mut self, id: I) -> PendingReply<R> {
|
||||
let (tx, rx) = oneshot::channel();
|
||||
self.pending.insert(id, tx);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue