Function libyml::document::yaml_document_add_scalar

source ·
pub unsafe fn yaml_document_add_scalar(
    document: *mut YamlDocumentT,
    tag: *const u8,
    value: *const u8,
    length: i32,
    style: YamlScalarStyleT,
) -> i32
Expand description

Create a SCALAR node and attach it to the document.

This function creates a new SCALAR node with the provided tag, value, 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.
  • value must be a valid, non-null pointer to a null-terminated UTF-8 string.
  • 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.