#[non_exhaustive]pub struct RssItem {
pub guid: String,
pub category: Option<String>,
pub description: String,
pub link: String,
pub pub_date: String,
pub title: String,
pub author: String,
pub comments: Option<String>,
pub enclosure: Option<String>,
pub source: Option<String>,
pub creator: Option<String>,
pub date: Option<String>,
}
Expand description
Represents an item in the RSS feed.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.guid: String
The GUID of the RSS item (unique identifier).
category: Option<String>
The category of the RSS item.
description: String
The description of the RSS item.
link: String
The link to the RSS item.
pub_date: String
The publication date of the RSS item.
title: String
The title of the RSS item.
The author of the RSS item.
comments: Option<String>
The comments URL related to the RSS item (optional).
enclosure: Option<String>
The enclosure (typically for media like podcasts) (optional).
source: Option<String>
The source of the RSS item (optional).
creator: Option<String>
The creator of the RSS item (optional).
date: Option<String>
The date the RSS item was created (optional).
Implementations§
Source§impl RssItem
impl RssItem
Sourcepub fn set<T: Into<String>>(self, field: RssItemField, value: T) -> Self
pub fn set<T: Into<String>>(self, field: RssItemField, value: T) -> Self
Sourcepub fn validate(&self) -> Result<()>
pub fn validate(&self) -> Result<()>
Validates the RssData
to ensure that all required fields are set and valid.
§Returns
Ok(())
if theRssData
is valid.Err(RssError)
if any validation errors are found.
§Errors
This function returns an Err(RssError)
in the following cases:
RssError::InvalidInput
if any fields such astitle
,link
, ordescription
are missing or invalid.RssError::ValidationErrors
if there are multiple validation issues found (e.g., invalid link, missing title, etc.).RssError::DateParseError
if thepub_date
cannot be parsed into a valid date.
Additionally, it can return an error if any of the custom validation rules are violated (e.g., maximum length for certain fields).
Sourcepub fn pub_date_parsed(&self) -> Result<DateTime>
pub fn pub_date_parsed(&self) -> Result<DateTime>
Sourcepub fn description<T: Into<String>>(self, value: T) -> Self
pub fn description<T: Into<String>>(self, value: T) -> Self
Sets the description.
Sets the author.