chiark / gitweb /
Have OpOutcomeThunk::Deferrecd take &mut InstanceGuard
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 29 Apr 2022 23:54:02 +0000 (00:54 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 30 Apr 2022 10:26:46 +0000 (11:26 +0100)
That way it can call modify_pieces_not_necessarily_saving_aux, which
the fastsplit_split implementaion wants.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
daemon/api.rs
src/updates.rs

index 4a59b5b68fd4ce1e44a903c2ed21323f47e759f3..b9d5636a33d7d459ee4889cb897c73c3ee18f11a 100644 (file)
@@ -145,7 +145,7 @@ fn api_piece_op<O: op::Complex>(form: Json<ApiPiece<O>>)
   })().and_then(|(thunk, loose_conflict)| Ok((
     match thunk {
       OpOutcomeThunk::Immediate(r) => r,
-      OpOutcomeThunk::Reborrow(f) => f(g, player, piece)?,
+      OpOutcomeThunk::Reborrow(f) => f(&mut ig, player, piece)?,
     }, loose_conflict
   ))) {
     Err(APOE::Inapplicable(poe)) => {
@@ -173,7 +173,7 @@ fn api_piece_op<O: op::Complex>(form: Json<ApiPiece<O>>)
         } else {
           Some((wrc, client, form.cseq))
         };
-      let mut buf = PrepareUpdatesBuffer::new(g,
+      let mut buf = PrepareUpdatesBuffer::new(&mut ig,
                                               Some(1 + log.len()));
 
       buf.piece_update(piece, &by_client, ops);
index 6e7acd3d18aa723d57e44b4bf8dfd0be27493724..db2780af2953f59eabaab423976663df969eb8c7 100644 (file)
@@ -196,7 +196,7 @@ pub enum OpOutcomeThunk {
   /// TODO: Provide cooked methods for this (taking `ModifyingPieces`)
   ///
   /// TODO: Provide a `ModifyingPieces` to the closure.
-  Reborrow(Box<dyn FnOnce(&mut Instance, PlayerId, PieceId)
+  Reborrow(Box<dyn FnOnce(&mut InstanceGuard, PlayerId, PieceId)
                    -> Result<UpdateFromOpComplex, ApiPieceOpError>>),
 }