chiark / gitweb /
fastsplit: Add some imprecations about not dropping FastSplitId
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 30 Apr 2022 10:14:17 +0000 (11:14 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 30 Apr 2022 14:15:30 +0000 (15:15 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
src/fastsplit.rs

index 39424e53c1b71e6edd78cbc1bb3aa1f55697916f..2b2c61a10176a24b3039655d3f6400eb1b26c21f 100644 (file)
@@ -80,6 +80,8 @@ impl Record {
 
 impl IFastSplits {
   /// During piece addition: make this into a new fastsplit piece family
+  ///
+  /// Do not just drop the result, because it contains an OwningOccultIlkId
   pub fn new_original(&mut self, ilks: &mut OccultIlks, ipc: IPiece)
                       -> (IPiece, FastSplitId) {
     let ipc = Arc::new(ipc);
@@ -89,6 +91,9 @@ impl IFastSplits {
   }
 
   /// During game load: recover a proper IPiece for a fastsplit piece
+  ///
+  /// Just dropping the result on error is ok, despite it containing
+  /// an OwningOccultIlkId, because in that case the whole game is toast.
   #[throws(as Option)]
   pub fn recover_ipc(&self, ilks: &mut OccultIlks, fsid: FastSplitId)
                      -> IPiece {
@@ -96,6 +101,7 @@ impl IFastSplits {
     Self::make_ipc(ilks, record.ipc.clone())
   }
 
+  /// Do not just drop the result, because it contains an OwningOccultIlkId
   fn make_ipc(ilks: &mut OccultIlks, ipc: Arc<IPiece>) -> IPiece {
     let occilk = ipc.occilk.as_ref().map(|i| ilks.clone_iilk(i));
     let special = ipc.special.clone();