From: Ian Jackson Date: Tue, 7 Jul 2020 20:27:29 +0000 (+0100) Subject: move RECENT_BUFFER to global.rs and use with_capacity X-Git-Tag: otter-0.2.0~1413 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=75daffccf81d169ce3dbb8b5560f5a21ff33dc5b;p=otter.git move RECENT_BUFFER to global.rs and use with_capacity --- diff --git a/junk/instance.rs b/junk/instance.rs deleted file mode 100644 index 2b7310b6..00000000 --- a/junk/instance.rs +++ /dev/null @@ -1,2 +0,0 @@ - -const RECENT_BUFFER : usize = 10; diff --git a/src/global.rs b/src/global.rs index 165f255a..c46c31ed 100644 --- a/src/global.rs +++ b/src/global.rs @@ -82,12 +82,21 @@ impl PieceUpdateOp { } } -#[derive(Debug,Default)] +#[derive(Debug)] pub struct PlayerUpdates { pub log : StableIndexVecDeque,sse::UpdateId>, pub cv : Arc, } +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,