parse

Function parse 

Source
pub fn parse(data: &[u8]) -> Result<ParsedFeed>
Expand description

Parse feed from raw bytes

This is the main entry point for parsing feeds. It automatically detects the feed format (RSS, Atom, JSON) and parses accordingly.

§Errors

Returns a FeedError if the feed cannot be parsed. However, in most cases, the parser will set the bozo flag and return partial results rather than returning an error.

§Examples

use feedparser_rs::parse;

let xml = r#"
    <?xml version="1.0"?>
    <rss version="2.0">
        <channel>
            <title>Example Feed</title>
        </channel>
    </rss>
"#;

let feed = parse(xml.as_bytes()).unwrap();
assert_eq!(feed.feed.title.as_deref(), Some("Example Feed"));