1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
pub mod caps;
pub mod html;
pub mod json;
pub mod rss;
pub use self::caps::Caps;
pub use self::html::Html;
pub use self::json::Json;
pub use self::rss::Rss;
use crate::entry::Entry;
use crate::error::source::parse::Error as ParseError;
#[allow(clippy::large_enum_variant)]
#[derive(Debug)]
pub enum Parser {
Html(Html),
Json(Json),
Rss(Rss),
Caps(Caps),
}
impl Parser {
pub fn parse(&self, entry: Entry) -> Result<Vec<Entry>, ParseError> {
Ok(match self {
Parser::Html(x) => x.parse(entry)?,
Parser::Json(x) => x.parse(entry)?,
Parser::Rss(x) => x.parse(entry)?,
Parser::Caps(x) => x.parse(entry),
})
}
}