Commits

camlspotter  committed 5e2892f Merge

merge

  • Participants
  • Parent commits 95cf126, 770a393
  • Branches js

Comments (0)

Files changed (3)

 - Unix.{file, mkdtemp, with_dtemp} added
 - Unix.mkdir is overridden
 * Renamed Unix.find to Added Unix.Find.find with poly record interface
+- Added Format.to_string
 
 2.1.2
 ------------

File lib/xformat.ml

   if Xlazy.is_val v then p ppf (Xlazy.(!!) v)
   else Format.fprintf ppf "lazy"
 
+let to_string f v =
+  let buf = Buffer.create 100 in
+  let ppf = formatter_of_buffer buf in
+  f ppf v;
+  flush ppf; 
+  Buffer.contents buf
+
 let sprintf fmt =
   let buf = Buffer.create 100 in
   let ppf = formatter_of_buffer buf in

File lib/xformat.mli

 val set_formatter_tag_functions : t -> formatter_tag_functions -> unit
 val formatter_tag_functions : t -> unit -> formatter_tag_functions
 
+val to_string : (Format.formatter -> 'a -> unit) -> 'a -> string
+
 val sprintf : ('a, t, unit, string) format4 -> 'a
   (** [sprintf] with a better type than the orignal *)