A port of OCaml's easy-format: pretty-printing of trees made of atoms, lists and labels, with styles
Dependencies
let point = @easy_format.T::List(("{", ",", "}", @easy_format.list), [
Label((Atom("x:", @easy_format.atom), @easy_format.label), Atom("1", @easy_format.atom)),
Label((Atom("y:", @easy_format.atom), @easy_format.label), Atom("2", @easy_format.atom)),
])
@easy_format.to_string(point) // "{ x: 1, y: 2 }"pub(all) enum Escape {
NoEscape
Escape(((StringView) -> Unit, StringView) -> Unit)
EscapeString((String) -> String)
}pub(all) struct LabelParam {
label_break : LabelBreak
space_after_label : Bool
indent_after_label : Int
label_style : String?
} derive(Eq, Debug)pub(all) struct ListParam {
space_after_opening : Bool
space_after_separator : Bool
space_before_separator : Bool
separators_stick_left : Bool
space_before_closing : Bool
stick_to_label : Bool
align_closing : Bool
wrap_body : Wrap
indent_body : Int
list_style : String?
opening_style : String?
body_style : String?
separator_style : String?
closing_style : String?
} derive(Eq, Debug)fn to_buffer(buf : StringBuilder, x : T, escape? : Escape, styles? : ArrayView[(String, Style)]) -> UnitInstall
Download zipA port of OCaml's easy-format: pretty-printing of trees made of atoms, lists and labels, with styles
Dependencies