package lwt
Install
Dune Dependency
Authors
Maintainers
Sources
md5=5a8d2a83ee9314781f137d147a4c62ae
sha512=b872b7abe546c431ba62fe466423d7ace8e487ebd85ea5e859f462eb4c0a6884b242d9efd4a557b6da3ae699b0b695e0a783f89a1d1147cba7d99c4ae9d2db17
doc/lwt.unix/Lwt_fmt/index.html
Module Lwt_fmt
Source
Format API for Lwt-powered IOs
This module bridges the gap between Format
and Lwt
. Although it is not required, it is recommended to use this module with the Fmt
library.
Compared to regular formatting function, the main difference is that printing statements will now return promises instead of blocking.
Returns a promise that prints on the standard output. Similar to Format.printf
.
Returns a promise that prints on the standard error. Similar to Format.eprintf
.
Formatters
Lwt enabled formatters
make_stream ()
returns a formatter and a stream of all the writing order given on that stream.
of_channel oc
creates a formatter that writes to the channel oc
.
Formatter printing on Lwt_io.stdout
.
Formatter printing on Lwt_io.stdout
.
make_formatter ~commit ~fmt
creates a new lwt formatter based on the Format.formatter
fmt
. The commit
function will be called by the printing functions to update the underlying channel.
get_formatter fmt
returns the underlying Format.formatter
. To access the underlying formatter during printing, it isvrecommended to use %t
and %a
.
Printing
flush fmt
flushes the formatter (as with Format.pp_print_flush
) and executes all the printing action on the underlying channel.
Low level functions
write_order oc o
applies the order o
on the channel oc
.