Skip to main content

serde_yml/
lib.rs

1// SPDX-License-Identifier: MIT OR Apache-2.0
2
3//! # ⚠️ `serde_yml` is deprecated — migrate to a maintained alternative
4//!
5//! This crate is **unmaintained**. The `0.0.13` release is a thin
6//! compatibility shim so existing call sites keep working while you
7//! plan a migration. See [`MIGRATION.md`](https://github.com/sebastienrousseau/serde_yml/blob/master/MIGRATION.md)
8//! for the full guide.
9//!
10//! ## Maintained alternatives
11//!
12//! - **[`noyalib`](https://crates.io/crates/noyalib)** — pure-Rust,
13//!   `#![forbid(unsafe_code)]`, drop-in via the `compat-serde-yaml`
14//!   feature (zero call-site changes for typical users).
15//! - **[`serde-saphyr`](https://crates.io/crates/serde-saphyr)** —
16//!   modern parser, serde-integrated typed deserialisation. **No
17//!   `Value` DOM** — fits codebases that only call
18//!   `from_str::<MyStruct>`.
19//! - **[`yaml-rust2`](https://crates.io/crates/yaml-rust2)** —
20//!   pure-Rust parser primitives, no `serde` wrapper. Fits users
21//!   who were using the low-level `serde_yml::libyml` / `loader`
22//!   surface (removed in this shim).
23//!
24//! `MIGRATION.md` carries the per-crate mapping tables.
25//!
26//! ## Why the shim is backed by `noyalib`
27//!
28//! The shim itself depends on `noyalib`'s `compat-serde-yaml`
29//! feature for its implementation. This is an implementation
30//! detail of the shim, not a recommendation that you must use
31//! `noyalib`. Two things follow:
32//!
33//! - **No archived advisory chain.** The previous C-FFI parser
34//!   (`libyml`) and `serde_yaml` 0.9 are gone from the dependency
35//!   graph entirely; downstream `cargo audit` / `cargo deny` runs
36//!   stop flagging the unmaintained chain.
37//! - **Safer defaults flow through.** `#![forbid(unsafe_code)]`,
38//!   YAML 1.2 strict booleans (the "Norway problem" fix), custom
39//!   tags preserved as `Value::Tagged` rather than coerced.
40//!
41//! If you want to evaluate `noyalib` directly, the
42//! `compat-serde-yaml` feature exposes the same surface this shim
43//! re-exports. If you'd rather pick a different alternative,
44//! `MIGRATION.md` covers `serde-saphyr` and `yaml-rust2`.
45//!
46//! ## Stop-gap: keep using `serde_yml = "0.0.13"`
47//!
48//! Existing call sites compile unchanged against this shim. Every
49//! item below is marked `#[deprecated]`, so the compiler will point
50//! at the spots that need updating during your migration.
51//!
52//! ## Removed in 0.0.13 (vs. 0.0.12)
53//!
54//! The deep internal modules that previous versions exposed —
55//! `serde_yml::libyml`, `serde_yml::loader`, `serde_yml::modules`,
56//! `serde_yml::de::{Event, Progress}`, `serde_yml::ser::SerializerConfig`,
57//! `serde_yml::value::Index`, `DocumentAnchor`, `State` — are
58//! **gone** in this release. They were implementation details of
59//! the C-FFI parser that no longer exists. See `MIGRATION.md` for
60//! the equivalence table per alternative.
61
62#![deprecated(
63    since = "0.0.13",
64    note = "serde_yml is unmaintained. Migrate to a maintained alternative (noyalib, serde-saphyr, or yaml-rust2). See MIGRATION.md."
65)]
66#![doc(html_root_url = "https://docs.rs/serde_yml/0.0.13")]
67
68// ── Top-level re-exports — name-for-name with serde_yml 0.0.13 ─────────
69
70#[doc(inline)]
71pub use noyalib::compat::serde_yaml::{
72    from_reader, from_slice, from_str, from_value, to_string, to_value,
73    to_writer, Deserializer, Error, Location, Mapping, Number, Result,
74    Sequence, Serializer, Tag, TaggedValue, Value,
75};
76
77// ── Sub-modules — keep path-form imports working ───────────────────────
78
79/// YAML value types. Re-exported from [`noyalib::compat::serde_yaml::value`].
80pub mod value {
81    pub use noyalib::compat::serde_yaml::value::{
82        Mapping, Number, Sequence, Tag, TaggedValue, Value,
83    };
84}
85
86/// YAML mapping type. Re-exported from [`noyalib::compat::serde_yaml::mapping`].
87pub mod mapping {
88    pub use noyalib::compat::serde_yaml::mapping::Mapping;
89}
90
91/// Serde `#[serde(with = "...")]` helpers. Re-exported from
92/// [`noyalib::compat::serde_yaml::with`].
93pub mod with {
94    pub use noyalib::compat::serde_yaml::with::{
95        nested_singleton_map, singleton_map, singleton_map_optional,
96        singleton_map_recursive, singleton_map_with,
97    };
98}