State.WithRef
State.S
default implementation relying on Ocaml ref
. The state is initialized with the given Elt.init
value.
val get_all_and_reset : unit -> E.t list
get_all_and_reset ()
evaluates in all the elements that were aggregated inside the state and then resets the state to its initial value. Elements are returned in the order they were pushed in the state (the resulting list starts by older elements).
val push : E.t -> unit
push elt
aggregates the given element elt
in the state.