Expand description
Drop-in serde_yaml replacement backed by
noyalib — rename the package in
Cargo.toml, change zero source lines.
# Cargo.toml — the whole migration:
serde_yaml = { package = "noyalib-serde-yaml", version = "=0.0.58" }Every use serde_yaml::… in the codebase keeps compiling
unchanged, and — since noyalib v0.0.29 made the shim
behavioural — keeps behaving like serde_yaml 0.9 where it
matters: << merge keys stay literal entries, 0123 stays a
string and 0b11 is 3, a literal 1e999 stays a string,
u64::MAX keeps full precision and one past it refuses as
JSON number out of range, non-scalar keys refuse as
invalid type: sequence, expected a string key, alias expansion
is budgeted with upstream’s repetition limit exceeded, and
parse errors carry libyaml’s phrasing and end-of-input location
convention. The 18-case contract suite pinning all of this —
with expectations captured live from serde_yaml 0.9.34 — ships
in the core repository (tests/serde_yaml_contract.rs).
Unlike the archived serde_yaml 0.9 this surface is maintained,
pure-Rust with #![forbid(unsafe_code)], and never re-introduces
the unmaintained crate or its advisory chain as a dependency.
§What this crate is
A re-export of noyalib::compat::serde_yaml under a package
name that Cargo’s package = rename can substitute for
serde_yaml. All engineering lives in noyalib; this crate pins
the core at the identical =0.0.X and adds nothing else.
§Examples
// In a migrated project this line reads
// `use serde_yaml::{from_str, to_string};` — unchanged from
// before the migration.
use noyalib_serde_yaml::{from_str, to_string};
#[derive(serde::Serialize, serde::Deserialize, PartialEq, Debug)]
struct Config {
name: String,
port: u16,
}
let cfg: Config = from_str("name: noyalib\nport: 8080\n").unwrap();
assert_eq!(cfg.port, 8080);
let back = to_string(&cfg).unwrap();
let round: Config = from_str(&back).unwrap();
assert_eq!(cfg, round);Modules§
- mapping
- Sub-module mirroring
serde_yaml::mapping. - value
- Sub-module mirroring
serde_yaml::value. - with
- Sub-module mirroring
serde_yaml::with.
Structs§
- Deserializer
- A YAML deserializer.
- Error
- The shim’s error type: a
crate::Errorrendered the wayserde_yaml0.9 worded and located it. - Location
- A
(line, column, byte index)location in a YAML document. - Mapping
- A YAML mapping (dictionary/object).
- Serializer
- A YAML serializer.
- Tag
- A YAML tag.
- Tagged
Value - A tagged YAML value.
Enums§
Functions§
- from_
reader - Deserialize a YAML document from any
std::io::Readsource. - from_
slice - Deserialize a YAML document from a byte slice.
- from_
str - Deserialize a YAML document into the target type — with
serde_yaml0.9’s observable behaviour, not noyalib’s defaults. - from_
str_ multi - Iterate every YAML document in a multi-document stream and
deserialize each into
T. Mirrors theDeserializer::from_strchained withinto_iter::<T>()— the typicalserde_yamlmulti-document idiom. - from_
value - Deserialize a typed value from a
Value. - to_
string - Serialize a typed value to a YAML string.
- to_
value - Serialize a typed value to a
Value. - to_
writer - Serialize a typed value to any
std::io::Writesink.
Type Aliases§
- Result
- Shim result type:
Result<T, Error>with the shim’s ownError. - Sequence
- A YAML sequence (array/list).