Owned items, static values
Some checks failed
CI / Typos (push) Failing after 20s
CI / Build and test (push) Failing after 2m17s
CI / Clippy (push) Failing after 3m27s
CI / Build and test (all features) (push) Failing after 5m56s

This commit is contained in:
2026-03-10 21:05:51 -07:00
parent 48ac93c78e
commit bfa67994bf
20 changed files with 304 additions and 378 deletions

View File

@@ -12,13 +12,13 @@ use crate::{
extract::{MapExtractor, ObjectExtractor},
};
pub struct EpubExtractor<'a> {
inner: MapExtractor<'a>,
pub struct EpubExtractor {
inner: MapExtractor,
}
impl<'a> EpubExtractor<'a> {
impl EpubExtractor {
#[expect(clippy::unwrap_used)]
pub fn new(item: &'a Item) -> Self {
pub fn new(item: &Item) -> Self {
let inner = MapExtractor {
inner: HashMap::from([
(
@@ -37,19 +37,8 @@ impl<'a> EpubExtractor<'a> {
}
#[async_trait::async_trait]
impl ObjectExtractor for EpubExtractor<'_> {
async fn field<'a>(
&'a self,
name: &pile_config::Label,
) -> Result<Option<&'a PileValue<'a>>, std::io::Error> {
#[expect(clippy::unwrap_used)]
if name.as_str() == "text" {
match self.inner.inner.get(name).unwrap() {
PileValue::ObjectExtractor(x) => return x.field(name).await,
_ => unreachable!(),
};
}
impl ObjectExtractor for EpubExtractor {
async fn field(&self, name: &pile_config::Label) -> Result<Option<PileValue>, std::io::Error> {
self.inner.field(name).await
}