From: Ian Jackson Date: Sun, 14 Mar 2021 16:44:49 +0000 (+0000) Subject: at: nest PuSynch a bit more X-Git-Tag: otter-0.4.0~72 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=e196f05e1e92a79a96294a551eb5c78b1b904775;p=otter.git at: nest PuSynch a bit more This makes it more generic. Signed-off-by: Ian Jackson --- diff --git a/apitest/at-otter.rs b/apitest/at-otter.rs index f294680d..58cb1759 100644 --- a/apitest/at-otter.rs +++ b/apitest/at-otter.rs @@ -448,15 +448,15 @@ impl PieceSpecForOp for PuUp<'_, PI> { #[derive(Debug)] /// Synchronise after op but before any ungrab. -pub struct PuSynch<'pcs, PI:Idx>(&'pcs mut Pieces, PI); +pub struct PuSynch<'pcs, PI:Idx>(PuUp<'pcs, PI>); impl PieceSpecForOp for PuSynch<'_,PI> { type PI = PI; - fn id(&self) -> &str { &self.0[self.1].id } + fn id(&self) -> &str { self.0.id() } fn for_update(&mut self) -> Option<&mut PieceInfo> { - Some(&mut self.0[self.1]) + self.0.for_update() } fn for_synch(&mut self) -> Option<&mut Pieces> { - Some(self.0) + Some(self.0.0) } } @@ -536,7 +536,7 @@ impl Ctx { .into_inner().unwrap(); dbgc!(&hand); - alice.api_piece(GH::With, PuSynch(&mut a_pieces, hand), ("k", json!({ + alice.api_piece(GH::With, PuSynch((&mut a_pieces, hand)), ("k", json!({ "opname": "claim", "wrc": "Unpredictable", })))?;