Ezr_tomlSlightly abstract API to save and load TOML files.
module TYPES : sig ... endinclude module type of TYPES
with type toml_handle = TYPES.toml_handle
and type section_option = TYPES.section_option
and type section = TYPES.sectiontype toml_handle = TYPES.toml_handletype section_option = TYPES.section_option = {option_name : string;option_comments : string list;option_value : Ez_toml.V1.TOML.Types.value;}type section = TYPES.section = {section_name : string;section_comments : string list;section_options : section_option list;}val make_empty : unit -> toml_handleCreates a new handle with an empty TOML table.
val toml : toml_handle -> Ez_toml.V1.TOML.Types.nodeAccess 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 section :
name:string ->
?after_comments:string list ->
section_option list ->
sectionCombinator to define sections.
val option :
name:string ->
?after_comments:string list ->
Ez_toml.V1.TOML.Types.value ->
section_optionCombinator to define section options.
val add_section_update :
toml_handle ->
string ->
(name:string -> section) ->
unitadd_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.
val load : ?verbose:bool -> string -> toml_handleload ~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 reload : ?verbose:bool -> string -> toml_handle -> unitreload ~verbose filename handle reloads the TOML file filename. Resets the handle to an empty TOML if filename does not exit. Raises Sys_error if the file exists but is not readable.
val save : ?verbose:bool -> string -> toml_handle -> unitsave ~verbose filename handle triggers update hooks (that update the TOML representation), and save it in filename if the representation has been modified.
For the purposes of caching, we reuse the same representation but remove update hooks (that are functional values).
Therefore, these need to be reinstated after loading a handle, using appropriate calls to add_section_update.
type cacheable = toml_handleval cacheable : toml_handle -> cacheableval checksum : toml_handle -> Stdlib.Digest.t