Function libyml::api::yaml_document_add_mapping

source ·
pub unsafe fn yaml_document_add_mapping(
    document: *mut YamlDocumentT,
    tag: *const u8,
    style: YamlMappingStyleT,
) -> i32
Expand description

Create a MAPPING node and attach it to the document.

This function creates a new MAPPING node with the provided tag and style, and adds it to the document’s node stack.

The style argument may be ignored by the emitter.

Returns the node id or 0 on error.

§Safety

  • document must be a valid, non-null pointer to a YamlDocumentT struct.
  • tag, if not null, must be a valid pointer to a null-terminated UTF-8 string.
  • The YamlDocumentT struct and its associated nodes must be properly initialized and their memory allocated correctly.
  • The YamlDocumentT struct and its associated nodes must be properly aligned and have the expected memory layout.
  • The caller is responsible for freeing the memory allocated for the document using yaml_document_delete.