package tezos-stdlib-unix

  1. Overview
  2. Docs
val make_with_animation : Stdlib.Format.formatter -> make:('seed -> ('result, 'failure) Stdlib.result Lwt.t) -> on_retry:(Mtime.Span.t -> 'failure -> 'seed Lwt.t) -> 'seed -> 'result Lwt.t

make_with_animation is meant to be used to execute time consuming functions that can be interrupted. Typically proof-of-work tasks. Whilst doing so, it displays a progress animation on the provided formatter (assumes support for '\b`). The animations leave the terminal clean.

make_with_animation ppf ~make ~on_retry seed behaves as follows: (a) if make seed is Ok v (completion of the task), then it returns v (b) if make seed is Error r (task is incomplete), then (b.1) on_retry t r is evaluated where t is the time elapsed during the call to make, and then (b.2) the result is used to attempt the task again.

val number_of_frames : int

The number of steps that the animation cycles through.

OCaml

Innovation. Community. Security.