Pure OCaml Yaml 1.2 reader and writer using Bytesrw
1(*---------------------------------------------------------------------------
2 Copyright (c) 2025 Anil Madhavapeddy <anil@recoil.org>. All rights reserved.
3 SPDX-License-Identifier: ISC
4 ---------------------------------------------------------------------------*)
5
6(** Collection layout styles *)
7
8type t = [
9 | `Any (** Let emitter choose *)
10 | `Block (** Indentation-based *)
11 | `Flow (** Inline with brackets *)
12]
13
14let to_string = function
15 | `Any -> "any"
16 | `Block -> "block"
17 | `Flow -> "flow"
18
19let pp fmt t =
20 Format.pp_print_string fmt (to_string t)
21
22let equal a b = a = b
23
24let compare a b =
25 let to_int = function
26 | `Any -> 0
27 | `Block -> 1
28 | `Flow -> 2
29 in
30 Int.compare (to_int a) (to_int b)