From: Ian Jackson Date: Fri, 31 Jul 2020 22:02:08 +0000 (+0100) Subject: explain why PlayerUpdate interface X-Git-Tag: otter-0.2.0~1212 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=ea2e369628d9793b7509a3d5729aeb1cf92cfea6;p=otter.git explain why PlayerUpdate interface --- diff --git a/src/updates.rs b/src/updates.rs index 9246a714..86dc5441 100644 --- a/src/updates.rs +++ b/src/updates.rs @@ -98,6 +98,8 @@ impl PlayerUpdates { self.log.push_back(update.into()); self.cv.notify_all(); } + // giving out only immutable references means no-one can + // forget to cv.notify pub fn read_log(&self) -> &PlayerUpdatesLog { &self.log } pub fn get_cv(&self) -> Arc { self.cv.clone() } }