Module Fmt.Dump

Contents

Instructions: Use this module in your project

In the IDE (CLion, Visual Studio Code, Xcode, etc.) you use for your DkSDK project:

  1. Add the following to your project's dependencies/CMakeLists.txt:

    Copy
    DkSDKProject_DeclareAvailable(fmt
        CONSTRAINT "= 0.9.0+dune"
        FINDLIBS fmt fmt.cli fmt.top fmt.tty)
    DkSDKProject_MakeAvailable(fmt)
  2. Add the Findlib::fmt library to any desired targets in src/*/CMakeLists.txt:

    Copy
    target_link_libraries(YourPackage_YourLibraryName
         # ... existing libraries, if any ...
         Findlib::fmt)
  3. Click your IDE's Build button

Not using DkSDK?

FIRST, do one or all of the following:

  1. Run:

    Copy
    opam install fmt.0.9.0+dune
  2. Edit your dune-project and add:

    Copy
    (package
      (name YourExistingPackage)
      (depends
      ; ... existing dependenices ...
      (fmt (>= 0.9.0+dune))))

    Then run:

    Copy
    dune build *.opam # if this fails, run: dune build
  3. Edit your <package>.opam file and add:

    Copy
    depends: [
      # ... existing dependencies ...
      "fmt" {>= "0.9.0+dune"}
    ]

    Then run:

    Copy
    opam install . --deps-only

FINALLY, add the fmt library to any desired (library)and/or (executable) targets in your **/dune files:

Copy
(library
  (name YourLibrary)
  ; ... existing library options ...
  (libraries
    ; ... existing libraries ...
    fmt))

(executable
  (name YourExecutable)
  ; ... existing executable options ...
  (libraries
    ; ... existing libraries ...
    fmt))

Stdlib types

valsignal : ``intt

signal formats an OCaml signal number as a C POSIX constant or "SIG(%d)" the signal number is unknown.

valuchar :Stdlib.Uchar.t t

uchar formats an OCaml Uchar.t value using only US-ASCII encoded characters according to the Unicode notational convention for code points.

valstring : ``stringt

string is pf ppf "%S".

valpair :'a t -> 'b t -> ``('a*'b)`` t

pair pp_fst pp_snd formats an OCaml pair using pp_fst and pp_snd for the first and second projection.

valoption :'a t -> 'aoption``t

option pp_v formats an OCaml option using pp_v for the Some case. No parentheses are added.

val result : ``ok:'a t -> ``error:'b t -> ``('a, 'b)`` result t

result ~ok ~error formats an OCaml result using ok for the Ok case value and error for the Error case value. No parentheses are added.

vallist :'a t -> 'alist``t

list pp_v formats an OCaml list using pp_v for the list elements.

valarray :'a t -> 'aarray``t

array pp_v formats an OCaml array using pp_v for the array elements.

valseq :'a t -> 'a Stdlib.Seq.t t

seq pp_v formats an OCaml sequence using pp_v for the sequence elements.

valhashtbl :'a t -> 'b t -> ``('a, 'b)`` Stdlib.Hashtbl.t t

hashtbl pp_k pp_v formats an unspecified representation of the bindings of a hash table using pp_k for the keys and pp_v for the values. If the hash table has multiple bindings for a given key, all bindings are formatted, with the most recent binding first.

valqueue :'a t -> 'a Stdlib.Queue.t t

queue pp_v formats an unspecified representation of an OCaml queue using pp_v to format its elements, in least recently added order.

valstack :'a t -> 'a Stdlib.Stack.t t

stack pp_v formats an unspecified representation of an OCaml stack using pp_v to format its elements in top to bottom order.

Records

valfield : ``?label:``stringt ->``string-> ``('b -> 'a)`` -> 'a t -> 'b t

field ~label l prj pp_v pretty prints a named field using label (defaults to styled `Yellow string) for the label, and using prj pp_v for the field value.

valrecord :'a tlist``-> 'a t

record fields pretty-prints a value using the concatenation of fields, separated by ";@,", framed in a vertical box and surrounded by braces.

Sequencing

These are akin to iter and iter_bindings but delimit the sequences with parens.

val iter : ``(``('a ->unit)``-> 'b ->unit)``-> 'b t -> 'a t -> 'b t

iter iter pp_name pp_elt formats an unspecified representation of the iterations of iter over a value using pp_elt. The iteration is named by pp_name.

val iter_bindings : ``(``('a -> 'b ->unit)``-> 'c ->unit)``-> 'c t -> 'a t -> 'b t -> 'c t

iter_bindings ~sep iter pp_name pp_k pp_v formats an unspecified representation of the iterations of iter over a value using pp_k and pp_v. The iteration is named by pp_name.

More from the DkSDK Book

    1. DkSDK
      1. Package capnp
        1. Module Capnp
            1. Module type MessageSig.MESSAGE
            1. Module type MessageSig.S
              1. Module S.ListStorage
              1. Module S.Message
              1. Module S.Object
              1. Module S.Segment
              1. Module S.Slice
              1. Module S.StructStorage
            1. Module type MessageSig.SEGMENT
            1. Module type MessageSig.SLICE
        1. Module Capnp_unix
      1. Package cmdliner
        1. Module Cmdliner
        1. Module Cmdliner_arg
        1. Module Cmdliner_base
        1. Module Cmdliner_cline
        1. Module Cmdliner_cmd
        1. Module Cmdliner_docgen
        1. Module Cmdliner_eval
        1. Module Cmdliner_info
        1. Module Cmdliner_manpage
        1. Module Cmdliner_msg
        1. Module Cmdliner_term
        1. Module Cmdliner_term_deprecated
        1. Module Cmdliner_trie
      1. Package fmt
        1. Module Fmt
          1. ...
          1. Module Fmt.Dump
          1. ...
        1. Module Fmt_cli
        1. Module Fmt_tty
      1. Package logs
        1. Module Logs
          1. Module type Logs.LOG
          1. ...
        1. Module Logs_cli
        1. Module Logs_fmt
        1. Module Logs_lwt
          1. Module type Logs_lwt.LOG
        1. Module Logs_threaded
      1. Package lwt
        1. Module Lwt
        1. Module Lwt_bytes
        1. Module Lwt_condition
        1. Module Lwt_config
        1. Module Lwt_engine
        1. Module Lwt_features
        1. Module Lwt_fmt
        1. Module Lwt_gc
        1. Module Lwt_io
            1. Module type Lwt_io.NumberIO
        1. Module Lwt_list
        1. Module Lwt_main
            1. Module type Lwt_main.Hooks
        1. Module Lwt_mutex
        1. Module Lwt_mvar
        1. Module Lwt_pool
        1. Module Lwt_pqueue
            1. Module type Lwt_pqueue.OrderedType
            1. Module type Lwt_pqueue.S
        1. Module Lwt_preemptive
        1. Module Lwt_process
        1. Module Lwt_result
        1. Module Lwt_seq
        1. Module Lwt_sequence
        1. Module Lwt_stream
        1. Module Lwt_switch
        1. Module Lwt_sys
        1. Module Lwt_throttle
            1. Module type Lwt_throttle.S
        1. Module Lwt_timeout
        1. Module Lwt_unix
      1. Package mtime
        1. Module Mtime
        1. Module Mtime_clock
      1. Package ocaml
        1. Module Bigarray
        1. Module Condition
        1. Module Dynlink
        1. Module Event
        1. Module Mutex
        1. Module Profiling
        1. Module Semaphore
        1. Module Stdlib
        1. Module Str
        1. Module Thread
        1. Module ThreadUnix
        1. Module Topdirs
        1. Module Unix
        1. Module UnixLabels
      1. Package
      1. Package result
        1. Module Result
      1. Package stdint
        1. Module Stdint
            1. Module type Stdint.Int