pub struct ParsedFeed {
pub feed: FeedMeta,
pub entries: Vec<Entry>,
pub bozo: bool,
pub bozo_exception: Option<String>,
pub encoding: String,
pub version: FeedVersion,
pub namespaces: HashMap<String, String>,
pub status: Option<u16>,
pub href: Option<String>,
pub etag: Option<String>,
pub modified: Option<String>,
pub headers: Option<HashMap<String, String>>,
}Expand description
Parsed feed result
This is the main result type returned by the parser, analogous to
Python feedparser’s FeedParserDict.
Fields§
§feed: FeedMetaFeed metadata
entries: Vec<Entry>Feed entries/items
bozo: boolTrue if parsing encountered errors
bozo_exception: Option<String>Description of parsing error (if bozo is true)
encoding: StringDetected or declared encoding
version: FeedVersionDetected feed format version
namespaces: HashMap<String, String>XML namespaces (prefix -> URI)
status: Option<u16>HTTP status code (if fetched from URL)
href: Option<String>Final URL after redirects (if fetched from URL)
etag: Option<String>ETag header from HTTP response
modified: Option<String>Last-Modified header from HTTP response
headers: Option<HashMap<String, String>>HTTP response headers (if fetched from URL)
Implementations§
Source§impl ParsedFeed
impl ParsedFeed
Sourcepub fn with_capacity(entry_count: usize) -> Self
pub fn with_capacity(entry_count: usize) -> Self
Creates a ParsedFeed with pre-allocated capacity for entries
This method pre-allocates space for the expected number of entries, reducing memory allocations during parsing.
§Arguments
entry_count- Expected number of entries in the feed
§Examples
use feedparser_rs::ParsedFeed;
let feed = ParsedFeed::with_capacity(50);
assert_eq!(feed.encoding, "utf-8");Sourcepub fn check_entry_limit(
&mut self,
reader: &mut Reader<&[u8]>,
buf: &mut Vec<u8>,
limits: &ParserLimits,
depth: &mut usize,
) -> Result<bool>
pub fn check_entry_limit( &mut self, reader: &mut Reader<&[u8]>, buf: &mut Vec<u8>, limits: &ParserLimits, depth: &mut usize, ) -> Result<bool>
Check if entry limit is reached, set bozo flag and skip element if so
This helper consolidates the duplicate entry limit checking logic used in RSS and Atom parsers. If the entry limit is reached, it:
- Sets
bozoflag to true - Sets
bozo_exceptionwith descriptive error message - Skips the entry element
- Returns
Ok(false)to signal that the entry should not be processed
§Arguments
reader- XML reader positioned at the entry elementbuf- Buffer for XML event readinglimits- Parser limits includingmax_entriesdepth- Current nesting depth (will be decremented)
§Returns
Ok(true)- Entry can be processed (limit not reached)Ok(false)- Entry limit reached, element was skipped
§Errors
Returns an error if:
- Skipping the entry element fails (e.g., malformed XML)
- Nesting depth exceeds limits while skipping
§Examples
// In parser:
if !feed.check_entry_limit(reader, &mut buf, limits, depth)? {
continue;
}
// Process entry...Trait Implementations§
Source§impl Clone for ParsedFeed
impl Clone for ParsedFeed
Source§fn clone(&self) -> ParsedFeed
fn clone(&self) -> ParsedFeed
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more