diff --git a/v0.5/fastn-package/src/reader.rs b/v0.5/fastn-package/src/reader.rs index 3fd11c35d..0579baeac 100644 --- a/v0.5/fastn-package/src/reader.rs +++ b/v0.5/fastn-package/src/reader.rs @@ -21,7 +21,7 @@ impl fastn_continuation::Continuation for State { fn continue_after( self, - _n: Vec<(String, Option)>, + _n: Vec<(String, &Option)>, ) -> fastn_continuation::Result { todo!() } diff --git a/v0.5/fastn/src/lib.rs b/v0.5/fastn/src/lib.rs index bc53996cd..640d68a68 100644 --- a/v0.5/fastn/src/lib.rs +++ b/v0.5/fastn/src/lib.rs @@ -24,11 +24,3 @@ pub enum OutputRequested { UI, Data, } - -pub fn full_filler(_i: Vec) -> Vec<(String, Option)> { - todo!() -} - -pub async fn full_filler_async(_i: Vec) -> Vec<(String, Option)> { - todo!() -} diff --git a/v0.5/fastn/src/section_provider.rs b/v0.5/fastn/src/section_provider.rs index bf97bfc13..012d3aaee 100644 --- a/v0.5/fastn/src/section_provider.rs +++ b/v0.5/fastn/src/section_provider.rs @@ -1,12 +1,20 @@ #[derive(Default)] -pub struct SectionProvider {} +pub struct SectionProvider { + cache: std::collections::HashMap>, +} #[async_trait::async_trait] -impl fastn_continuation::AsyncMutProvider for &SectionProvider { +impl<'a> fastn_continuation::AsyncMutProvider for &'a SectionProvider { type Needed = Vec; - type Found = Vec<(String, Option)>; + type Found = Vec<(String, &'a Option)>; - async fn provide(&mut self, _needed: Vec) -> Self::Found { - todo!() + async fn provide(&mut self, needed: Vec) -> Self::Found { + let mut r = vec![]; + for f in needed { + if let Some(doc) = self.cache.get(&f) { + r.push((f, doc)); + } + } + r } }