change serde_yaml to serde_yml

This commit is contained in:
zyl 2024-06-21 15:01:38 -07:00
parent 91c65fa017
commit 35ac34b69c
No known key found for this signature in database
4 changed files with 65 additions and 14 deletions

73
Cargo.lock generated
View file

@ -411,6 +411,16 @@ version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
[[package]]
name = "errno"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba"
dependencies = [
"libc",
"windows-sys 0.52.0",
]
[[package]] [[package]]
name = "extract-frontmatter" name = "extract-frontmatter"
version = "4.1.1" version = "4.1.1"
@ -427,6 +437,12 @@ dependencies = [
"once_cell", "once_cell",
] ]
[[package]]
name = "fastrand"
version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a"
[[package]] [[package]]
name = "file-id" name = "file-id"
version = "0.1.0" version = "0.1.0"
@ -1071,6 +1087,18 @@ version = "0.2.155"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c"
[[package]]
name = "libyml"
version = "0.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3e281a65eeba3d4503a2839252f86374528f9ceafe6fed97c1d3b52e1fb625c1"
[[package]]
name = "linux-raw-sys"
version = "0.4.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89"
[[package]] [[package]]
name = "litemap" name = "litemap"
version = "0.7.3" version = "0.7.3"
@ -1708,6 +1736,19 @@ dependencies = [
"semver", "semver",
] ]
[[package]]
name = "rustix"
version = "0.38.34"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f"
dependencies = [
"bitflags 2.5.0",
"errno",
"libc",
"linux-raw-sys",
"windows-sys 0.52.0",
]
[[package]] [[package]]
name = "ryu" name = "ryu"
version = "1.0.18" version = "1.0.18"
@ -1805,16 +1846,20 @@ dependencies = [
] ]
[[package]] [[package]]
name = "serde_yaml" name = "serde_yml"
version = "0.9.34+deprecated" version = "0.0.10"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47" checksum = "78ce6afeda22f0b55dde2c34897bce76a629587348480384231205c14b59a01f"
dependencies = [ dependencies = [
"indexmap", "indexmap",
"itoa 1.0.11", "itoa 1.0.11",
"libyml",
"log",
"memchr",
"ryu", "ryu",
"serde", "serde",
"unsafe-libyaml", "serde_json",
"tempfile",
] ]
[[package]] [[package]]
@ -1940,6 +1985,18 @@ dependencies = [
"syn 2.0.66", "syn 2.0.66",
] ]
[[package]]
name = "tempfile"
version = "3.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1"
dependencies = [
"cfg-if",
"fastrand",
"rustix",
"windows-sys 0.52.0",
]
[[package]] [[package]]
name = "thin-slice" name = "thin-slice"
version = "0.1.1" version = "0.1.1"
@ -2179,12 +2236,6 @@ version = "1.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
[[package]]
name = "unsafe-libyaml"
version = "0.2.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "673aac59facbab8a9007c7f6108d11f63b603f7cabff99fabf650fea5c32b861"
[[package]] [[package]]
name = "url" name = "url"
version = "2.5.1" version = "2.5.1"
@ -2619,7 +2670,7 @@ dependencies = [
"pulldown-cmark", "pulldown-cmark",
"rss", "rss",
"serde", "serde",
"serde_yaml", "serde_yml",
"time", "time",
"tokio", "tokio",
"url", "url",

View file

@ -23,7 +23,7 @@ pulldown-cmark = {version = "0.11", default-features = false, features = [
]} ]}
rss = {version = "2", features = ["validation"]} rss = {version = "2", features = ["validation"]}
serde = {version = "1", features = ["derive"]} serde = {version = "1", features = ["derive"]}
serde_yaml = "0.9" serde_yml = "0.0.10"
time = {version = "0.3", features = ["serde-human-readable"]} time = {version = "0.3", features = ["serde-human-readable"]}
tokio = {version = "1.10", features = [ tokio = {version = "1.10", features = [
"macros", "macros",

View file

@ -93,7 +93,7 @@ pub struct Site {
impl Site { impl Site {
/// Creates a new site from the given path. /// Creates a new site from the given path.
pub fn new(site_path: &Path) -> eyre::Result<Self> { pub fn new(site_path: &Path) -> eyre::Result<Self> {
let config: SiteConfig = serde_yaml::from_str( let config: SiteConfig = serde_yml::from_str(
&std::fs::read_to_string(site_path.join("config.yaml")) &std::fs::read_to_string(site_path.join("config.yaml"))
.wrap_err("Failed to read site config")?, .wrap_err("Failed to read site config")?,
) )

View file

@ -61,7 +61,7 @@ fn create(
builder.build_blog()?; builder.build_blog()?;
} }
} else if relative_path.display().to_string() == "config.yaml" { } else if relative_path.display().to_string() == "config.yaml" {
let new_config = serde_yaml::from_str(&std::fs::read_to_string(path)?)?; let new_config = serde_yml::from_str(&std::fs::read_to_string(path)?)?;
builder.site.config = new_config; builder.site.config = new_config;
builder.site.build_all_pages(builder)?; builder.site.build_all_pages(builder)?;
} else if let Ok(_sass_path) = relative_path.strip_prefix(SASS_PATH) { } else if let Ok(_sass_path) = relative_path.strip_prefix(SASS_PATH) {