module Jbuffer: sig
.. end
All-in-one formatter. Return the JSON encoding of formatted text.
type
json = Json.t
val format : ?indent:int ->
?margin:int ->
('a, Format.formatter, unit, json) Pervasives.format4 -> 'a
All-in-one formatter. Return the JSON encoding of formatted text.
val to_json : ?indent:int ->
?margin:int -> (Format.formatter -> 'a -> unit) -> 'a -> json
All-in-one formatter. Return the JSON encoding of formatted text.
type
buffer
Buffer for encoding formatted text.
val create : ?indent:int -> ?margin:int -> unit -> buffer
Create a formatter with ~indent
maximum indentation and
~margin
right-margin. Defaults are those of Format.make_formatter
,
which are ~indent:68
and ~margin:78
with OCaml 4.05.
val formatter : buffer -> Format.formatter
The underlying formatter of a buffer.
val bprintf : buffer -> ('a, Format.formatter, unit) Pervasives.format -> 'a
Prints into the buffer's formatter.
val append : buffer -> string -> int -> int -> unit
val flush : buffer -> unit -> unit
val push_tag : buffer -> Format.tag -> unit
val pop_tag : buffer -> Format.tag -> unit
val contents : buffer -> json
Flushes the buffer and returns its JSON enoding. This pops all pending
tags.
val fprintf : Format.formatter -> json -> unit
Prints back a JSON encoding onto the provided formatter.
Raises Yojson.Basic.Util.Type_error
in case of ill formatted buffer.