diff --git a/Cargo.lock b/Cargo.lock index 24b844a..ce4c42c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "ansi_term" @@ -46,7 +46,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e98e2ad1a782e33928b96fc3948e7c355e5af34ba4de7670fe8bac2a3b2006d" dependencies = [ "quote", - "syn", + "syn 1.0.73", ] [[package]] @@ -56,10 +56,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0e25ea47919b1560c4e3b7fe0aaab9becf5b84a10325ddf7db0f0ba5e1026499" [[package]] -name = "dtoa" -version = "0.4.8" +name = "equivalent" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56899898ce76aaf4a0f24d914c97ea6ed976d42fec6ad33fcbb0a1103e07b2b0" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" [[package]] name = "format_serde_error" @@ -70,11 +70,17 @@ dependencies = [ "pretty_assertions", "serde", "serde_json", - "serde_yaml", + "serde_yaml_ng", "toml", "unicode-segmentation", ] +[[package]] +name = "hashbrown" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5419bdc4f6a9207fbeba6d11b604d481addf78ecd10c11ad51e76c2f6482748d" + [[package]] name = "hermit-abi" version = "0.1.19" @@ -84,12 +90,28 @@ dependencies = [ "libc", ] +[[package]] +name = "indexmap" +version = "2.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6717a8d2a5a929a1a2eb43a12812498ed141a0bcfb7e8f7844fbdbe4303bba9f" +dependencies = [ + "equivalent", + "hashbrown", +] + [[package]] name = "itoa" version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" +[[package]] +name = "itoa" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" + [[package]] name = "lazy_static" version = "1.4.0" @@ -102,12 +124,6 @@ version = "0.2.97" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "12b8adadd720df158f4d70dfe7ccc6adb0472d7c55ca83445f6a5ab3e36f8fb6" -[[package]] -name = "linked-hash-map" -version = "0.5.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3" - [[package]] name = "output_vt100" version = "0.1.2" @@ -131,18 +147,18 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.27" +version = "1.0.103" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0d8caf72986c1a598726adc988bb5984792ef84f5ee5aa50209145ee8077038" +checksum = "5ee95bc4ef87b8d5ba32e8b7714ccc834865276eab0aed5c9958d00ec45f49e8" dependencies = [ - "unicode-xid", + "unicode-ident", ] [[package]] name = "quote" -version = "1.0.9" +version = "1.0.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7" +checksum = "ce25767e7b499d1b604768e7cde645d14cc8584231ea6b295e9c9eb22c02e1d1" dependencies = [ "proc-macro2", ] @@ -155,22 +171,32 @@ checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" [[package]] name = "serde" -version = "1.0.126" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec7505abeacaec74ae4778d9d9328fe5a5d04253220a85c4ee022239fc996d03" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.126" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "963a7dbc9895aeac7ac90e74f34a5d5261828f79df35cbed41e10189d3804d43" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.108", ] [[package]] @@ -179,21 +205,22 @@ version = "1.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "799e97dc9fdae36a5c8b8f2cae9ce2ee9fdce2058c57a93e6099d919fd982f79" dependencies = [ - "itoa", + "itoa 0.4.7", "ryu", "serde", ] [[package]] -name = "serde_yaml" -version = "0.8.17" +name = "serde_yaml_ng" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15654ed4ab61726bf918a39cb8d98a2e2995b002387807fa6ba58fdf7f59bb23" +checksum = "7b4db627b98b36d4203a7b458cf3573730f2bb591b28871d916dfa9efabfd41f" dependencies = [ - "dtoa", - "linked-hash-map", + "indexmap", + "itoa 1.0.15", + "ryu", "serde", - "yaml-rust", + "unsafe-libyaml", ] [[package]] @@ -207,6 +234,17 @@ dependencies = [ "unicode-xid", ] +[[package]] +name = "syn" +version = "2.0.108" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da58917d35242480a05c2897064da0a80589a2a0476c9a3f2fdc83b53502e917" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + [[package]] name = "toml" version = "0.5.8" @@ -216,6 +254,12 @@ dependencies = [ "serde", ] +[[package]] +name = "unicode-ident" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "462eeb75aeb73aea900253ce739c8e18a67423fadf006037cd3ff27e82748a06" + [[package]] name = "unicode-segmentation" version = "1.8.0" @@ -228,6 +272,12 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" +[[package]] +name = "unsafe-libyaml" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "673aac59facbab8a9007c7f6108d11f63b603f7cabff99fabf650fea5c32b861" + [[package]] name = "winapi" version = "0.3.9" @@ -249,12 +299,3 @@ name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - -[[package]] -name = "yaml-rust" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85" -dependencies = [ - "linked-hash-map", -] diff --git a/Cargo.toml b/Cargo.toml index 4a569cb..a8a54cc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,14 +20,14 @@ edition = "2018" all-features = true [features] -default = ["serde_yaml", "serde_json", "colored", "graphemes_support", "toml"] +default = ["serde_yaml_ng", "serde_json", "colored", "graphemes_support", "toml"] graphemes_support = ["unicode-segmentation"] [dependencies] colored = { version = "2", optional = true } serde_json = { version = "1", optional = true } serde = { version = "1", features = ["derive"] } -serde_yaml = { version = "0.8", optional = true } +serde_yaml_ng = { version = "0.10", optional = true } unicode-segmentation = { version = "1", optional = true } toml = { version = "0.5", optional = true } @@ -37,11 +37,11 @@ pretty_assertions = "0.7" [[example]] name = "serde_yaml" -required-features = ["serde_yaml"] +required-features = ["serde_yaml_ng"] [[example]] name = "serde_yaml_long" -required-features = ["serde_yaml"] +required-features = ["serde_yaml_ng"] [[example]] name = "serde_json" diff --git a/README.md b/README.md index 964bac3..a9b8bf5 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ fn main() -> Result<(), anyhow::Error> { - 'second' - third:"; - let config = serde_yaml::from_str::(config_str) + let config = serde_yaml_ng::from_str::(config_str) .map_err(|err| SerdeError::new(config_str.to_string(), err))?; dbg!(config); diff --git a/examples/serde_yaml.rs b/examples/serde_yaml.rs index b6c5ee9..c56e107 100644 --- a/examples/serde_yaml.rs +++ b/examples/serde_yaml.rs @@ -11,7 +11,7 @@ fn main() -> Result<(), anyhow::Error> { - 'second' - third:"; - let config = serde_yaml::from_str::(config_str) + let config = serde_yaml_ng::from_str::(config_str) .map_err(|err| SerdeError::new(config_str.to_string(), err))?; dbg!(config); diff --git a/examples/serde_yaml_long.rs b/examples/serde_yaml_long.rs index 83e3efa..8f5947d 100644 --- a/examples/serde_yaml_long.rs +++ b/examples/serde_yaml_long.rs @@ -16,7 +16,7 @@ fn main() -> Result<(), anyhow::Error> { consectetur in eu felis. Vivamus lacus odio, tincidunt ac elit vel, varius \ ultricies est. In blandit tincidunt interdum."; - let config = serde_yaml::from_str::(config_str) + let config = serde_yaml_ng::from_str::(config_str) .map_err(|err| SerdeError::new(config_str.to_string(), err))?; dbg!(config); diff --git a/src/lib.rs b/src/lib.rs index 00481e1..948b684 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -13,13 +13,13 @@ //! values: Vec, //! } //! # fn main() { -//! # #[cfg(feature = "serde_yaml")] +//! # #[cfg(feature = "serde_yaml_ng")] //! # if let Err(err) = parse_config() { //! # eprintln!("{}", err) //! # } //! # } //! -//! # #[cfg(feature = "serde_yaml")] +//! # #[cfg(feature = "serde_yaml_ng")] //! fn parse_config() -> Result { //! let config_str = "values: //! - 'first' @@ -224,9 +224,9 @@ pub enum ErrorTypes { /// Contains [`serde_json::Error`]. Json(serde_json::Error), - #[cfg(feature = "serde_yaml")] - /// Contains [`serde_yaml::Error`]. - Yaml(serde_yaml::Error), + #[cfg(feature = "serde_yaml_ng")] + /// Contains [`serde_yaml_ng::Error`]. + Yaml(serde_yaml_ng::Error), #[cfg(feature = "toml")] /// Contains [`toml::de::Error`]. @@ -259,9 +259,9 @@ impl From for ErrorTypes { } } -#[cfg(feature = "serde_yaml")] -impl From for ErrorTypes { - fn from(err: serde_yaml::Error) -> Self { +#[cfg(feature = "serde_yaml_ng")] +impl From for ErrorTypes { + fn from(err: serde_yaml_ng::Error) -> Self { Self::Yaml(err) } } @@ -293,7 +293,7 @@ impl SerdeError { #[cfg(feature = "serde_json")] ErrorTypes::Json(e) => (e.to_string(), Some(e.line()), Some(e.column())), - #[cfg(feature = "serde_yaml")] + #[cfg(feature = "serde_yaml_ng")] ErrorTypes::Yaml(e) => match e.location() { // Don't set line/column if we don't have a location None => (e.to_string(), None, None), diff --git a/src/test/mod.rs b/src/test/mod.rs index 69745c7..940e452 100644 --- a/src/test/mod.rs +++ b/src/test/mod.rs @@ -104,7 +104,7 @@ mod toml { } // TODO: Make tests that only use serde_yaml feature -#[cfg(all(feature = "serde_yaml", feature = "colored"))] +#[cfg(all(feature = "serde_yaml_ng", feature = "colored"))] mod yaml { use anyhow::bail; use colored::Colorize; @@ -116,7 +116,7 @@ mod yaml { }; fn run_yaml(config_str: &str) -> Result { - match serde_yaml::from_str::(config_str) { + match serde_yaml_ng::from_str::(config_str) { Ok(_) => bail!("expecting error got a ok"), Err(err) => Ok(format!("{}", SerdeError::new(config_str.to_string(), err))), }