⚠️ libyml is deprecated — migrate to a maintained alternative
libyml is unmaintained. v0.0.6 is a thin compatibility shim
that forwards every call to the upstream
unsafe-libyaml (which
libyml was originally forked from), so existing call sites keep
working while you plan a migration.
Security — RUSTSEC-2025-0067 fixed in 0.0.6
RUSTSEC-2025-0067
flagged all libyml ≤ 0.0.5 as unsound — the
libyml::string::yaml_string_extend function had a code path
that could trigger undefined behaviour. v0.0.6 removes the
vulnerable surface entirely — the entire libyml::string
module is gone from the source tree alongside the rest of the
hand-translated C-libyaml copy, and every public function is now
re-exported from unsafe-libyaml.
cargo audit will still warn anyway because the RustSec
advisory database tracks the crate's unmaintained status rather
than code presence. See the README's "cargo audit" section
for a copy-paste .cargo/audit.toml snippet.
Maintained alternatives
| Crate | Migration shape | Best fit |
|---|---|---|
unsafe-libyaml |
Drop-in upstream — rename PascalCase types/consts to snake_case / SCREAMING_SNAKE_CASE | Codebases that want to stay on the raw libyaml-shaped FFI API on a maintained backend |
yaml-rust2 |
Not FFI-shaped — YamlLoader::load_from_str returns a Yaml AST |
Users who want to drop the C-libyaml model entirely while keeping a low-level parser primitive in pure Rust |
noyalib |
Higher-level typed API (from_str::<T> / Value); pure-Rust, #![forbid(unsafe_code)] |
Users who can move from event-stream parsing to typed deserialisation |
Full mapping tables and behavioural notes:
MIGRATION.md.
What changed in 0.0.6
- ~18 000 lines of hand-translated C-libyaml code deleted from
src/; every public function is now re-exported from
unsafe-libyaml. - Historical path-form sub-modules (
libyml::api,
libyml::decode,libyml::document,libyml::dumper,
libyml::loader,libyml::yaml,libyml::success) retained
as thin re-exports. libyml::memoryandlibyml::stringretained as empty stub
modules with deprecation notes (their former contents — the
C-allocator wrappers and theyaml_string_extendunsound
helper — are gone).Cargo.toml: single runtime dep onunsafe-libyaml = "0.2.11".
Dual-licensed MIT / Apache-2.0 (was MIT-only) to match upstream.- v0.0.5 test and example files retained where they survive the
shim's compatibility boundary, so the migration shape is
visible side-by-side with the working tree.
Breaking changes (documented in MIGRATION.md)
Most downstream code compiles unchanged against this shim. Three
deltas flow through from the upstream:
c_int→boolfor boolean parameters
(yaml_scalar_event_initialize(..., 1, 1, …)→
yaml_scalar_event_initialize(..., true, true, …)).libyml::success::Successis no longer a nameable type —
read.okon return values directly.- PascalCase enum variants stay valid in value position but
rename toYAML_*SCREAMING_SNAKE_CASE inmatcharms.
Diff at a glance
76 files changed, 2 449 insertions, 20 584 deletions.