From 3bdac6df3946e96e8cfa52cf605c92983c689474 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Fri, 31 Jul 2020 22:31:41 +0100 Subject: [PATCH] break out PlayerUpdates.push nfc --- src/updates.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/updates.rs b/src/updates.rs index 367a838f..b33142d4 100644 --- a/src/updates.rs +++ b/src/updates.rs @@ -90,6 +90,13 @@ impl Default for PlayerUpdates { } } } +impl PlayerUpdates { + fn push>>(&mut self, update: U) { + self.log.push_back(update.into()); + self.cv.notify_all(); + } +} + impl PreparedUpdate { pub fn json_len(&self) -> usize { self.us.iter().map(|u| 20 + u.json_len()).sum() @@ -266,8 +273,7 @@ impl<'r> Drop for PrepareUpdatesBuffer<'r> { eprintln!("UPDATE {:?}", &update); for (_tplayer, tplupdates) in &mut self.g.updates { - tplupdates.log.push_back(update.clone()); - tplupdates.cv.notify_all(); + tplupdates.push(update.clone()); } } } -- 2.30.2