chiark / gitweb /
move RECENT_BUFFER to global.rs and use with_capacity
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 7 Jul 2020 20:27:29 +0000 (21:27 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 7 Jul 2020 20:27:29 +0000 (21:27 +0100)
junk/instance.rs [deleted file]
src/global.rs

diff --git a/junk/instance.rs b/junk/instance.rs
deleted file mode 100644 (file)
index 2b7310b..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-
-const RECENT_BUFFER : usize = 10;
index 165f255a95f9da014fb3b215f1cc5a34ff2f42be..c46c31edd942590d15a1abdf3413fa2fec02618d 100644 (file)
@@ -82,12 +82,21 @@ impl<NS> PieceUpdateOp<NS> {
   }
 }      
 
-#[derive(Debug,Default)]
+#[derive(Debug)]
 pub struct PlayerUpdates {
   pub log : StableIndexVecDeque<Arc<PreparedUpdate>,sse::UpdateId>,
   pub cv : Arc<Condvar>,
 }
 
+const RECENT_BUFFER : usize = 50;
+
+impl Default for PlayerUpdates {
+  fn default() -> PlayerUpdates { PlayerUpdates {
+    log : StableIndexVecDeque::with_capacity(RECENT_BUFFER),
+    cv : Default::default(),
+  } }
+}
+
 #[derive(Debug)]
 pub struct Instance {
   pub gs : GameState,