chiark
/
gitweb
/
~ianmdlvl
/
otter.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
a99e96a
)
break out PlayerUpdates.push nfc
author
Ian Jackson
<ijackson@chiark.greenend.org.uk>
Fri, 31 Jul 2020 21:31:41 +0000
(22:31 +0100)
committer
Ian Jackson
<ijackson@chiark.greenend.org.uk>
Fri, 31 Jul 2020 21:31:41 +0000
(22:31 +0100)
src/updates.rs
patch
|
blob
|
history
diff --git
a/src/updates.rs
b/src/updates.rs
index 367a838fe5ea0b8a0cde437db15d0a4e68b28e93..b33142d40e566f8365940ac6ca18bf876f8c3f20 100644
(file)
--- a/
src/updates.rs
+++ b/
src/updates.rs
@@
-90,6
+90,13
@@
impl Default for PlayerUpdates {
} }
}
+impl PlayerUpdates {
+ fn push<U: Into<Arc<PreparedUpdate>>>(&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());
}
}
}