On the way to getting rid of the other ad-hoc resolution site.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
piece,
was_held,
);
- let unprepared = match thunk {
- Err(e) => Err(e),
- Ok(OpHookThunk::Immediate(uu)) => Ok(uu),
- Ok(OpHookThunk::Reborrow(f)) => f(&mut ig, (player,)),
- };
+ let unprepared = thunk.resolve(&mut ig, (player,));
if let Ok(unprepared) = unprepared.map_err(
|e| error!("internal error on change hook: {:?}", e));
then {
pub use PriOccultedGeneral as PriOG;
// updates.rs
+pub use OpOutcomeThunkGeneric as OOTG;
pub type PUE = PreparedUpdateEntry;
pub type PUFOS = PieceUpdateFromOpSimple;
pub type PUO<NS,ZL> = PieceUpdateOp<NS,ZL>;
fn zero() -> Self { UpdateId(0) }
}
+#[ext(pub)]
+impl<A,T,E> Result<OpOutcomeThunkGeneric<A,T,E>,E> {
+ fn resolve(self, ig: &mut InstanceGuard, args: A) -> Result<T,E> {
+ match self {
+ Err(e) => Err(e),
+ Ok(OOTG::Immediate(uu)) => Ok(uu),
+ Ok(OOTG::Reborrow(f)) => f(ig, args),
+ }
+ }
+}
+
// ---------- prepared updates, queued in memory ----------
pub struct PlayerUpdatesStartContext {