Internal Representations
These types expose the internal INI representation for use by Init_bytesrw and other codec backends. Most users should use the high-level Section and Document modules instead.
INI Values
type ini_value = {raw : string;(*The raw value before interpolation (e.g.,
*)"%(base)s/data").interpolated : string;(*The value after interpolation (e.g.,
*)"/opt/app/data").meta : Meta.t;(*Source location and layout.
*)
}The type for decoded INI values. The raw field preserves the original text for round-tripping, while interpolated has variables expanded.
INI Sections
type ini_section = {name : string node;(*Section name with metadata (e.g.,
*)"server").options : (string node * ini_value) list;(*List of (option_name, value) pairs in file order.
*)meta : Meta.t;(*Metadata for the section header line.
*)
}The type for decoded INI sections.
INI Documents
type ini_doc = {defaults : (string node * ini_value) list;(*Options from the DEFAULT section (available to all sections).
*)sections : ini_section list;(*All non-DEFAULT sections in file order.
*)meta : Meta.t;(*Document-level metadata.
*)
}The type for decoded INI documents.
Codec State
Internal state used by section and document codecs.
type 'a section_state = {decode : ini_section -> 'a codec_result;encode : 'a -> ini_section;known_options : string list;unknown_handler : [ `Skip | `Error | `Keep ];
}Section codec state. The known_options list is used to validate that required options are present and to detect unknown options.
type 'a document_state = {decode : ini_doc -> 'a codec_result;encode : 'a -> ini_doc;known_sections : string list;unknown_handler : [ `Skip | `Error ];
}Document codec state.