Skip to main content

OpOutcomeThunk

Type Alias OpOutcomeThunk 

Source
pub type OpOutcomeThunk = OpOutcomeThunkGeneric<(PlayerId, PieceId), (PieceUpdate, Vec<Box<dyn for<'r> FnOnce(&'r mut PrepareUpdatesBuffer<'_>)>>), ApiPieceOpError>;

Aliased Type§

pub enum OpOutcomeThunk {
    Immediate((PieceUpdate, Vec<Box<dyn for<'r> FnOnce(&'r mut PrepareUpdatesBuffer<'_>)>>)),
    Reborrow(Box<dyn FnOnce(&mut InstanceGuard<'_>, (PlayerId, PieceId)) -> Result<(PieceUpdate, Vec<Box<dyn for<'r> FnOnce(&'r mut PrepareUpdatesBuffer<'_>)>>), ApiPieceOpError>>),
}

Variants§

§

Immediate((PieceUpdate, Vec<Box<dyn for<'r> FnOnce(&'r mut PrepareUpdatesBuffer<'_>)>>))

§

Reborrow(Box<dyn FnOnce(&mut InstanceGuard<'_>, (PlayerId, PieceId)) -> Result<(PieceUpdate, Vec<Box<dyn for<'r> FnOnce(&'r mut PrepareUpdatesBuffer<'_>)>>), ApiPieceOpError>>)

Allows an operation full mutable access to the whole Instance.

Use with care! Eg, you might have to call save_game_and_aux_later.

Adding and removing pieces during play (rather than management) is complicated, because we want to avoid having to rewrite the aux. file during routine game saves. fastsplit.rs has machinery that can achieve this.