val printf : ('a, Stdlib.Format.formatter, unit, unit Lwt.t) Stdlib.format4 -> 'a
Returns a promise that prints on the standard output. Similar to Format.printf
.
val eprintf : ('a, Stdlib.Format.formatter, unit, unit Lwt.t) Stdlib.format4 -> 'a
Returns a promise that prints on the standard error. Similar to Format.eprintf
.
Formatters
type order =
| String of string * int * int |
|
| Flush | Flush operation |
val make_stream : unit -> order Lwt_stream.t * formatter
make_stream ()
returns a formatter and a stream of all the writing order given on that stream.
val of_channel : Lwt_io.output_channel -> formatter
of_channel oc
creates a formatter that writes to the channel oc
.
val stdout : formatter
Formatter printing on Lwt_io.stdout
.
val stderr : formatter
Formatter printing on Lwt_io.stdout
.
val make_formatter : commit:(unit -> unit Lwt.t) -> fmt:Stdlib.Format.formatter -> unit -> formatter
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.
val get_formatter : formatter -> Stdlib.Format.formatter
get_formatter fmt
returns the underlying Format.formatter
. To access the underlying formatter during printing, it isvrecommended to use %t
and %a
.
Printing
val fprintf : formatter -> ('a, Stdlib.Format.formatter, unit, unit Lwt.t) Stdlib.format4 -> 'a
val kfprintf : (formatter -> unit Lwt.t -> 'a) -> formatter -> ('b, Stdlib.Format.formatter, unit, 'a) Stdlib.format4 -> 'b
val ifprintf : formatter -> ('a, Stdlib.Format.formatter, unit, unit Lwt.t) Stdlib.format4 -> 'a
val ikfprintf : (formatter -> unit Lwt.t -> 'a) -> formatter -> ('b, Stdlib.Format.formatter, unit, 'a) Stdlib.format4 -> 'b
flush fmt
flushes the formatter (as with Format.pp_print_flush
) and executes all the printing action on the underlying channel.
val write_order : Lwt_io.output_channel -> order -> unit Lwt.t
write_order oc o
applies the order o
on the channel oc
.