[['a, 'b]]map_engine :
map_done:('a -> 'b engine_state) -> ?map_error:exn -> 'b engine_state -> ?map_aborted:unit -> 'b engine_state -> ?propagate_working:bool -> 'a #engine ->
map_engineobserves the argument engine, and when the state changes to
`Aborted, the corresponding mapping function is called, and the resulting state becomes the state of the mapped engine. If the engine is already in one of the mentioned states, the map functions are also called (unlike
After the state change to
`Aborted has been
observed, the map engine detaches from the argument engine,
and no further state changes are recognized.
`Working cannot be mapped to another state. It is an
error to map final states to
The result type of the
map_* functions is
final_state because of historic reasons.
If the mapped engine is aborted, this request will be forwarded to the argument engine.
If one of the mapping functions raises an exception, this causes
a transiton to
map_done: Maps the
`Donestate of the argument engine to another state. The argument of
map_doneis the argument of the
`Donestate. Note that
map_doneis non-optional only because of typing. If it were optional, the type checker would infer
'a = 'b.
map_error: Maps the
`Errorstate of the argument engine to another state. The argument of
map_erroris the argument of the
map_aborted: Maps the
`Abortedstate of the argument engine to another state.
propagate_working: Specifies whether changes of the
`Workingstate in the argument engine are propagated. Defaults to
true. If set to
false, the mapped engine remains in
`Working 0until it transitions to a final state.