Skip to main content

Crate libyml

Crate libyml 

Source
👎Deprecated since 0.0.6:

libyml is unmaintained. Migrate to a maintained alternative (unsafe-libyaml, yaml-rust2, or noyalib). See MIGRATION.md.

Expand description

§⚠️ libyml is deprecated — migrate to a maintained alternative

This crate is unmaintained. The 0.0.6 release is a thin compatibility shim so existing call sites keep working while you plan a migration. See MIGRATION.md for the full guide.

§Maintained alternatives

  • unsafe-libyaml — the upstream Rust translation of C libyaml that libyml was originally forked from. Same yaml_* function surface, actively maintained. Drop-in replacement for users on the raw FFI-shaped API.
  • yaml-rust2 — pure-Rust low-level parser, no FFI. Returns a Yaml enum AST instead of the event-stream model. Fits users who want to move off the C-libyaml shape entirely while keeping a low-level parser primitive.
  • noyalib — modern, pure-Rust, #![forbid(unsafe_code)] YAML library with a high-level typed API (from_str::<T> / Value). Fits users who can move from event-stream parsing to typed deserialisation.

MIGRATION.md carries the per-crate mapping tables.

§Why the shim is backed by unsafe-libyaml

libyml was originally a fork of unsafe-libyaml with cosmetic renames (snake_case → PascalCase for type names). The 0.0.6 shim reverts those renames internally and re-exports the upstream’s functions and types, restoring the historical PascalCase aliases so existing call sites compile unchanged.

This is an implementation detail, not a recommendation that you must use unsafe-libyaml. Two things follow:

  • No duplicated unsafe translation in the dependency graph. Downstream users link the upstream’s audited copy of the C-libyaml translation rather than this fork’s stale copy.
  • Bug fixes flow through. Anything fixed in unsafe-libyaml lands in users of this shim on a plain cargo update, without a new libyml release.

If you want to evaluate yaml-rust2 or noyalib directly, MIGRATION.md covers both.

§Stop-gap: keep using libyml = "0.0.6"

Existing call sites compile unchanged against this shim. Every item below is marked #[deprecated], so the compiler will point at the spots that need updating during your migration.

§What still resolves under libyml::* (0.0.6)

Most of the previous public surface is retained via thin re-export modules pointing at unsafe-libyaml:

The historical libyml::memory and libyml::string paths still resolve, but as empty stub modules — every former item under them is gone because they belonged to the hand-translated C copy this shim deletes (libyml::string::yaml_string_extend is the unsound helper RUSTSEC-2025-0067 flags).

§Removed in 0.0.6 (vs. 0.0.5)

The implementation-detail modules — libyml::internal, libyml::macros, libyml::externs, libyml::utils, libyml::libc, the contents of libyml::memory and libyml::string, and the yaml-test-suite runner binaries under src/bin/ — are gone in this release. See MIGRATION.md for the equivalence table per alternative.

Modules§

apiDeprecated
API-surface helpers. Re-exported from the crate root for source compatibility with libyml ≤ 0.0.5’s libyml::api module.
decodeDeprecated
Parser-decode helpers. Re-exported from the crate root for source compatibility with libyml ≤ 0.0.5’s libyml::decode module.
documentDeprecated
Document-tree helpers. Re-exported from the crate root for source compatibility with libyml ≤ 0.0.5’s libyml::document module.
dumperDeprecated
Emitter dumper helpers. Re-exported from the crate root for source compatibility with libyml ≤ 0.0.5’s libyml::dumper module. Note: the previous releases also exposed yaml_emitter_dump_node / _scalar / _sequence / _mapping as pub items; the upstream keeps those private. Callers should drive emission through the public yaml_emitter_dump entry point.
loaderDeprecated
Event-loader helpers. Re-exported from the crate root for source compatibility with libyml ≤ 0.0.5’s libyml::loader module. Note: the previous releases also exposed yaml_parser_set_composer_error as a pub item; the upstream surfaces composer errors through yaml_parser_parse / yaml_parser_load directly, so callers that constructed composer errors manually need to switch to inspecting parser.problem after the regular parse APIs return failure.
memoryDeprecated
Removed in 0.0.6. Previous releases exposed a hand-translated C-libyaml allocator surface (yaml_malloc / yaml_free / yaml_realloc / yaml_strdup). Those helpers were implementation details of the hand-translated parser, which the 0.0.6 shim deletes; the upstream unsafe-libyaml uses Rust’s alloc directly. Allocate with Rust’s standard primitives instead. This empty module is retained so that use libyml::memory; keeps resolving — every former item under it is gone.
stringDeprecated
Removed in 0.0.6 — see RUSTSEC-2025-0067. Previous releases exposed yaml_string_extend / yaml_string_join helpers under this path. The 0.0.6 shim deletes the entire hand-translated C copy that those helpers belonged to. Build strings with Rust’s Vec / String instead. This empty module is retained so use libyml::string; keeps resolving — every former item under it is gone.
successDeprecated
Success/failure helpers retained for source compatibility with libyml ≤ 0.0.5.
yamlDeprecated
Type aliases. Re-exported from the crate root for source compatibility with libyml ≤ 0.0.5’s libyml::yaml module — all Yaml*T PascalCase types and Yaml* PascalCase enum variants land at this path too.

Constants§

YamlAliasEventDeprecated
Alias for unsafe_libyaml::YAML_ALIAS_EVENT.
YamlAnyEncodingDeprecated
Alias for unsafe_libyaml::YAML_ANY_ENCODING.
YamlAnyMappingStyleDeprecated
Alias for unsafe_libyaml::YAML_ANY_MAPPING_STYLE.
YamlAnyScalarStyleDeprecated
Alias for unsafe_libyaml::YAML_ANY_SCALAR_STYLE.
YamlAnySequenceStyleDeprecated
Alias for unsafe_libyaml::YAML_ANY_SEQUENCE_STYLE.
YamlBlockMappingStyleDeprecated
Alias for unsafe_libyaml::YAML_BLOCK_MAPPING_STYLE.
YamlBlockSequenceStyleDeprecated
Alias for unsafe_libyaml::YAML_BLOCK_SEQUENCE_STYLE.
YamlComposerErrorDeprecated
Alias for unsafe_libyaml::YAML_COMPOSER_ERROR.
YamlDocumentEndEventDeprecated
Alias for unsafe_libyaml::YAML_DOCUMENT_END_EVENT.
YamlDocumentStartEventDeprecated
Alias for unsafe_libyaml::YAML_DOCUMENT_START_EVENT.
YamlDoubleQuotedScalarStyleDeprecated
Alias for unsafe_libyaml::YAML_DOUBLE_QUOTED_SCALAR_STYLE.
YamlEmitterErrorDeprecated
Alias for unsafe_libyaml::YAML_EMITTER_ERROR.
YamlFlowMappingStyleDeprecated
Alias for unsafe_libyaml::YAML_FLOW_MAPPING_STYLE.
YamlFlowSequenceStyleDeprecated
Alias for unsafe_libyaml::YAML_FLOW_SEQUENCE_STYLE.
YamlFoldedScalarStyleDeprecated
Alias for unsafe_libyaml::YAML_FOLDED_SCALAR_STYLE.
YamlLiteralScalarStyleDeprecated
Alias for unsafe_libyaml::YAML_LITERAL_SCALAR_STYLE.
YamlMappingEndEventDeprecated
Alias for unsafe_libyaml::YAML_MAPPING_END_EVENT.
YamlMappingNodeDeprecated
Alias for unsafe_libyaml::YAML_MAPPING_NODE.
YamlMappingStartEventDeprecated
Alias for unsafe_libyaml::YAML_MAPPING_START_EVENT.
YamlMemoryErrorDeprecated
Alias for unsafe_libyaml::YAML_MEMORY_ERROR.
YamlNoErrorDeprecated
Alias for unsafe_libyaml::YAML_NO_ERROR.
YamlNoEventDeprecated
Alias for unsafe_libyaml::YAML_NO_EVENT.
YamlNoNodeDeprecated
Alias for unsafe_libyaml::YAML_NO_NODE.
YamlParserErrorDeprecated
Alias for unsafe_libyaml::YAML_PARSER_ERROR.
YamlPlainScalarStyleDeprecated
Alias for unsafe_libyaml::YAML_PLAIN_SCALAR_STYLE.
YamlReaderErrorDeprecated
Alias for unsafe_libyaml::YAML_READER_ERROR.
YamlScalarEventDeprecated
Alias for unsafe_libyaml::YAML_SCALAR_EVENT.
YamlScalarNodeDeprecated
Alias for unsafe_libyaml::YAML_SCALAR_NODE.
YamlScannerErrorDeprecated
Alias for unsafe_libyaml::YAML_SCANNER_ERROR.
YamlSequenceEndEventDeprecated
Alias for unsafe_libyaml::YAML_SEQUENCE_END_EVENT.
YamlSequenceNodeDeprecated
Alias for unsafe_libyaml::YAML_SEQUENCE_NODE.
YamlSequenceStartEventDeprecated
Alias for unsafe_libyaml::YAML_SEQUENCE_START_EVENT.
YamlSingleQuotedScalarStyleDeprecated
Alias for unsafe_libyaml::YAML_SINGLE_QUOTED_SCALAR_STYLE.
YamlStreamEndEventDeprecated
Alias for unsafe_libyaml::YAML_STREAM_END_EVENT.
YamlStreamStartEventDeprecated
Alias for unsafe_libyaml::YAML_STREAM_START_EVENT.
YamlUtf8EncodingDeprecated
Alias for unsafe_libyaml::YAML_UTF8_ENCODING.
YamlUtf16beEncodingDeprecated
Alias for unsafe_libyaml::YAML_UTF16BE_ENCODING.
YamlUtf16leEncodingDeprecated
Alias for unsafe_libyaml::YAML_UTF16LE_ENCODING.
YamlWriterErrorDeprecated
Alias for unsafe_libyaml::YAML_WRITER_ERROR.

Functions§

yaml_alias_event_initialize
Create an ALIAS event.
yaml_document_delete
Delete a YAML document and all its nodes.
yaml_document_end_event_initialize
Create the DOCUMENT-END event.
yaml_document_get_node
Get a node of a YAML document.
yaml_document_get_root_node
Get the root of a YAML document node.
yaml_document_initialize
Create a YAML document.
yaml_document_start_event_initialize
Create the DOCUMENT-START event.
yaml_emitter_close
Finish a YAML stream.
yaml_emitter_delete
Destroy an emitter.
yaml_emitter_dump
Emit a YAML document.
yaml_emitter_emit
Emit an event.
yaml_emitter_flush
Flush the accumulated characters to the output.
yaml_emitter_initialize
Initialize an emitter.
yaml_emitter_open
Start a YAML stream.
yaml_emitter_set_break
Set the preferred line break.
yaml_emitter_set_canonical
Set if the output should be in the “canonical” format as in the YAML specification.
yaml_emitter_set_encoding
Set the output encoding.
yaml_emitter_set_indent
Set the indentation increment.
yaml_emitter_set_output
Set a generic output handler.
yaml_emitter_set_output_string
Set a string output.
yaml_emitter_set_unicode
Set if unescaped non-ASCII characters are allowed.
yaml_emitter_set_width
Set the preferred line width. -1 means unlimited.
yaml_event_delete
Free any memory allocated for an event object.
yaml_mapping_end_event_initialize
Create a MAPPING-END event.
yaml_mapping_start_event_initialize
Create a MAPPING-START event.
yaml_parser_delete
Destroy a parser.
yaml_parser_initialize
Initialize a parser.
yaml_parser_load
Parse the input stream and produce the next YAML document.
yaml_parser_parse
Parse the input stream and produce the next parsing event.
yaml_parser_scan
Scan the input stream and produce the next token.
yaml_parser_set_encoding
Set the source encoding.
yaml_parser_set_input
Set a generic input handler.
yaml_parser_set_input_string
Set a string input.
yaml_scalar_event_initialize
Create a SCALAR event.
yaml_sequence_end_event_initialize
Create a SEQUENCE-END event.
yaml_sequence_start_event_initialize
Create a SEQUENCE-START event.
yaml_stream_end_event_initialize
Create the STREAM-END event.
yaml_stream_start_event_initialize
Create the STREAM-START event.
yaml_token_delete
Free any memory allocated for a token object.

Type Aliases§

YamlAliasDataTDeprecated
Alias for unsafe_libyaml::yaml_alias_data_t.
YamlBreakTDeprecated
Alias for unsafe_libyaml::yaml_break_t.
YamlDocumentTDeprecated
Alias for unsafe_libyaml::yaml_document_t.
YamlEmitterStateTDeprecated
Alias for unsafe_libyaml::yaml_emitter_state_t.
YamlEmitterTDeprecated
Alias for unsafe_libyaml::yaml_emitter_t.
YamlEncodingTDeprecated
Alias for unsafe_libyaml::yaml_encoding_t.
YamlErrorTypeTDeprecated
Alias for unsafe_libyaml::yaml_error_type_t.
YamlEventTDeprecated
Alias for unsafe_libyaml::yaml_event_t.
YamlEventTypeTDeprecated
Alias for unsafe_libyaml::yaml_event_type_t.
YamlMappingStyleTDeprecated
Alias for unsafe_libyaml::yaml_mapping_style_t.
YamlMarkTDeprecated
Alias for unsafe_libyaml::yaml_mark_t.
YamlNodeItemTDeprecated
Alias for unsafe_libyaml::yaml_node_item_t.
YamlNodePairTDeprecated
Alias for unsafe_libyaml::yaml_node_pair_t.
YamlNodeTDeprecated
Alias for unsafe_libyaml::yaml_node_t.
YamlNodeTypeTDeprecated
Alias for unsafe_libyaml::yaml_node_type_t.
YamlParserStateTDeprecated
Alias for unsafe_libyaml::yaml_parser_state_t.
YamlParserTDeprecated
Alias for unsafe_libyaml::yaml_parser_t.
YamlReadHandlerTDeprecated
Alias for unsafe_libyaml::yaml_read_handler_t.
YamlScalarStyleTDeprecated
Alias for unsafe_libyaml::yaml_scalar_style_t.
YamlSequenceStyleTDeprecated
Alias for unsafe_libyaml::yaml_sequence_style_t.
YamlSimpleKeyTDeprecated
Alias for unsafe_libyaml::yaml_simple_key_t.
YamlStackTDeprecated
Alias for unsafe_libyaml::yaml_stack_t.
YamlTagDirectiveTDeprecated
Alias for unsafe_libyaml::yaml_tag_directive_t.
YamlTokenTDeprecated
Alias for unsafe_libyaml::yaml_token_t.
YamlTokenTypeTDeprecated
Alias for unsafe_libyaml::yaml_token_type_t.
YamlVersionDirectiveTDeprecated
Alias for unsafe_libyaml::yaml_version_directive_t.
YamlWriteHandlerTDeprecated
Alias for unsafe_libyaml::yaml_write_handler_t.