ipod syncing; updated readme; rust 2024; version bump

This commit is contained in:
Aaron Manning
2025-09-21 09:07:18 +10:00
parent fcc6acda56
commit 19330e66c9
11 changed files with 419 additions and 82 deletions

View File

@@ -8,8 +8,6 @@ use std::{
},
};
use anyhow::Context;
#[derive(Debug, Default, serde::Serialize, serde::Deserialize)]
pub(crate) struct Specification<'a> {
files: HashMap<Cow<'a, str>, Cow<'a, path::Path>>,
@@ -74,13 +72,11 @@ impl<'a> Specification<'a> {
&mut self,
id: impl Into<Cow<'a, str>>,
path: impl Into<Cow<'a, path::Path>>,
) -> anyhow::Result<()> {
) -> Option<Cow<'a, path::Path>> {
self.files.insert(
id.into(),
path.into()
)
.context("insertion of episode with duplicate id")
.map(|_| ())
}
pub(crate) fn insert_into_feed(
@@ -100,6 +96,15 @@ impl<'a> Specification<'a> {
}
}
}
pub(crate) fn files_and_feed_mut(
&mut self,
) -> (
&mut BTreeMap<chrono::NaiveDateTime, Vec<Episode<'a>>>,
&HashMap<Cow<'a, str>, Cow<'a, path::Path>>,
) {
(&mut self.feed, &self.files)
}
}
#[derive(Debug, serde::Serialize, serde::Deserialize)]