Skip to main content

news_flash/models/
conversion_results.rs

1use super::{Category, CategoryMapping, Enclosure, FatArticle, Feed, FeedMapping, Headline, Tagging};
2
3pub struct StreamConversionResult {
4    pub articles: Vec<FatArticle>,
5    pub headlines: Vec<Headline>,
6    pub taggings: Vec<Tagging>,
7    pub enclosures: Vec<Enclosure>,
8}
9
10impl Default for StreamConversionResult {
11    fn default() -> Self {
12        Self::new()
13    }
14}
15
16impl StreamConversionResult {
17    pub fn new() -> Self {
18        Self {
19            articles: Vec::new(),
20            headlines: Vec::new(),
21            taggings: Vec::new(),
22            enclosures: Vec::new(),
23        }
24    }
25
26    pub fn add(&mut self, mut other: Self) {
27        self.articles.append(&mut other.articles);
28        self.headlines.append(&mut other.headlines);
29        self.taggings.append(&mut other.taggings);
30        self.enclosures.append(&mut other.enclosures);
31    }
32}
33
34pub struct FeedConversionResult {
35    pub feeds: Vec<Feed>,
36    pub feed_mappings: Vec<FeedMapping>,
37    pub categories: Vec<Category>,
38    pub category_mappings: Vec<CategoryMapping>,
39}