Rust library to generate static websites
5
fork

Configure Feed

Select the types of activity you want to include in your feed.

refactor: use type alias

+8 -17
+8 -17
crates/framework/src/content.rs
··· 29 29 Self(collections) 30 30 } 31 31 32 - pub fn get_untyped_collection(&self, name: &str) -> &ContentSource<FxHashMap<String, String>> { 32 + pub fn get_untyped_collection(&self, name: &str) -> &ContentSource<Untyped> { 33 33 self.0 34 34 .iter() 35 - .find_map(|source| { 36 - match source 37 - .as_any() 38 - .downcast_ref::<ContentSource<FxHashMap<String, String>>>() 39 - { 35 + .find_map( 36 + |source| match source.as_any().downcast_ref::<ContentSource<Untyped>>() { 40 37 Some(source) if source.name == name => Some(source), 41 38 _ => None, 42 - } 43 - }) 39 + }, 40 + ) 44 41 .unwrap_or_else(|| panic!("Collection with name '{}' not found", name)) 45 42 } 46 43 47 - pub fn get_untyped_collection_safe( 48 - &self, 49 - name: &str, 50 - ) -> Option<&ContentSource<FxHashMap<String, String>>> { 44 + pub fn get_untyped_collection_safe(&self, name: &str) -> Option<&ContentSource<Untyped>> { 51 45 self.0.iter().find_map(|source| { 52 - match source 53 - .as_any() 54 - .downcast_ref::<ContentSource<FxHashMap<String, String>>>() 55 - { 46 + match source.as_any().downcast_ref::<ContentSource<Untyped>>() { 56 47 Some(source) if source.name == name => Some(source), 57 48 _ => None, 58 49 } ··· 81 72 } 82 73 } 83 74 84 - pub struct ContentSource<T = FxHashMap<String, String>> { 75 + pub struct ContentSource<T = Untyped> { 85 76 pub name: String, 86 77 pub entries: Vec<ContentEntry<T>>, 87 78 }