From 960d5b8f2728f71dd9ce038d527844d82ca2f0f2 Mon Sep 17 00:00:00 2001 From: Sébastien Dailly Date: Thu, 30 Apr 2026 09:16:03 +0200 Subject: Allow updates for existing contents --- lib/common/format.ml | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 lib/common/format.ml (limited to 'lib/common/format.ml') diff --git a/lib/common/format.ml b/lib/common/format.ml new file mode 100644 index 0000000..5245dd0 --- /dev/null +++ b/lib/common/format.ml @@ -0,0 +1,10 @@ +(** [format_string f] call the function [f] with a fresh formatter and return + the content as a string *) +let format_string : (Stdlib.Format.formatter -> unit) -> string = + fun f -> + let buff = Buffer.create 16 in + let format = Stdlib.Format.formatter_of_buffer buff in + let () = f format in + + Stdlib.Format.pp_print_flush format (); + Buffer.contents buff -- cgit v1.2.3