Module V1.EZTOML

module TYPES : sig ... end

Initialization & Accessor

val make_empty : unit -> TYPES.toml_file

Creates a new handle with an empty TOML table.

Access to the underlying TOML node.

Please handle with care: any mutation of the returned node leads to undefined behaviors (mutations of this node should only happen via update hooks).

val checksum : TYPES.toml_file -> string

Section definitions

val section : name:string -> ?comments:string list -> 'value TYPES.section_option list -> 'value TYPES.section

Combinator to define sections.

val option : ?comments:string list -> getter:('value -> TOML.Types.value) -> setter:('value -> TOML.Types.node -> unit) -> string -> 'value TYPES.section_option

Combinator to define section options.

val add_section : TYPES.toml_file -> 'value -> 'value TYPES.section -> unit

add_section_update handle section_name create_section equips handle with an update hook that calls create_section ~name upon each call to save, to determine whether the TOML representation needs to be updated.

Input/output

val load : ?verbose:bool -> string -> TYPES.toml_file

load ~verbose filename load and returns a handle for the TOML file filename. Returns an empty TOML if filename does not exist. Raises Sys_error if the file exists but is not readable.

val save : ?verbose:bool -> string -> TYPES.toml_file -> unit

save ~verbose filename handle triggers update hooks (that update the TOML representation), and save it in filename if the representation has been modified.

val option_string : ?comments:string list -> string -> getter:('a -> string) -> setter:('a -> string -> unit) -> 'a TYPES.section_option
val option_string_option : ?comments:string list -> string -> getter:('a -> string option) -> setter:('a -> string option -> unit) -> 'a TYPES.section_option
val option_string_map : ?comments:string list -> string -> getter:('a -> string EzCompat.StringMap.t) -> setter:('a -> string EzCompat.StringMap.t -> unit) -> 'a TYPES.section_option
val option_int : ?comments:string list -> string -> getter:('a -> int) -> setter:('a -> int -> unit) -> 'a TYPES.section_option
val option_bool : ?comments:string list -> string -> getter:('a -> bool) -> setter:('a -> bool -> unit) -> 'a TYPES.section_option