package octez-smart-rollup-node-lib

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Exposes the underlying implementation of line segments for testing. This API is unstable, unsafe and mostly undocumented; here be dragons etc.

module Line_buffer : sig ... end
type 'a t

The type of segments of progress bars that display reported values of type 'a.

type event = [
  1. | `report
  2. | `rerender
  3. | `tick
  4. | `finish
]
type theta := Progress_engine__.Line_buffer.t -> event -> unit
type 'a alpha := Progress_engine__.Line_buffer.t -> event -> 'a -> unit
val noop : unit -> _ t
val theta : width:int -> theta -> _ t
val alpha : width:int -> initial:[ `Theta of Progress_engine__.Line_buffer.t -> unit | `Val of 'a ] -> 'a alpha -> 'a t
val alpha_unsized : initial: [ `Theta of width:(unit -> int) -> Progress_engine__.Line_buffer.t -> int | `Val of 'a ] -> (width:(unit -> int) -> Progress_engine__.Line_buffer.t -> event -> 'a -> int) -> 'a t
val array : 'a t array -> 'a t
val pair : ?sep:unit t -> 'a t -> 'b t -> ('a * 'b) t
val contramap : f:('a -> 'b) -> 'b t -> 'a t
val on_finalise : 'a -> 'a t -> 'a t
val of_pp : width:int -> initial:'a -> (Format.formatter -> event -> 'a -> unit) -> 'a t

of_pp ~width pp is a segment that uses the supplied fixed-width pretty-printer to render the value. The pretty-printer must never emit newline characters.

val conditional : ('a -> bool) -> 'a t -> 'a t

conditional pred s has the same output format as s, but is only passes reported values down to s when they satisfy pred.

Stateful segments

val periodic : int -> 'a t -> 'a t

periodic n s has the same output format as s, but only passes reported values down to s on every n-th call. This is useful when progress is being reported from a hot-loop, where the cost of rendering is non-negligible.

val accumulator : ('a -> 'a -> 'a) -> 'a -> 'a t -> 'a t

accumulator combine zero s has the same output format s.

val stateful : (unit -> 'a t) -> 'a t

stateful f is a segment that behaves as f () for any given render, allowing f to initialise any display state at the start of the rendering process.

Dynamically-sized segments

Certain segments can have their size determined dynamically by being wrapped inside one of the following boxes:

val box_dynamic : ?pad:[ `left | `right | `none ] -> (unit -> int) -> 'a t -> 'a t

box w is a box that wraps a dynamically-sized segment and sets it to have size w () on each tick.

val box_fixed : ?pad:[ `left | `right | `none ] -> int -> 'a t -> 'a t

box-fixed n s fixes the size of the dynamic segment s to be n.

val box_winsize : ?max:int -> ?fallback:int -> 'a t -> 'a t

A box that takes on the current size of the terminal (or fallback if stdout is not attached to a terminal).

  • parameter fallback

    defaults to 80.

  • parameter max

    defaults to no limit.

val to_line : 'a t -> 'a t
OCaml

Innovation. Community. Security.