Skip to main content

parse_with_options

Function parse_with_options 

Source
pub fn parse_with_options(
    data: &[u8],
    options: &ParseOptions,
) -> Result<ParsedFeed>
Expand description

Parse feed from raw bytes with full control over parser behavior

This is the most flexible entry point: parse and parse_with_limits are thin wrappers around it. Controls HTML sanitization, relative URI resolution, and resource limits via crate::ParseOptions.

§Examples

use feedparser_rs::{parse_with_options, ParseOptions};

// Trust the feed source and skip sanitization
let options = ParseOptions {
    sanitize_html: false,
    ..ParseOptions::default()
};
let xml = b"<rss version=\"2.0\"><channel><title>Test</title></channel></rss>";
let feed = parse_with_options(xml, &options).unwrap();

§Errors

Returns an error if:

  • Feed size exceeds limits
  • Format is unknown or unsupported
  • Fatal parsing error occurs