feed-rs 2.3.1

A feed parser that handles Atom, RSS 2.0, RSS 1.0, RSS 0.x and JSON Feed
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use std::io::BufRead;

use crate::model::{Feed, FeedType};
use crate::parser::{rss2, ParseFeedResult, Parser};
use crate::xml::Element;

#[cfg(test)]
mod tests;

/// Parses an RSS 0.9x feed into our model
pub(crate) fn parse<R: BufRead>(parser: &Parser, root: Element<R>) -> ParseFeedResult<Feed> {
    // The 0.9x models are upward compatible with 2.x so we just delegate to that parser then set the correct type
    rss2::parse(parser, root).map(|mut feed| {
        feed.feed_type = FeedType::RSS0;
        feed
    })
}