#[non_exhaustive]pub struct RssData {Show 19 fields
pub atom_link: String,
pub author: String,
pub category: String,
pub copyright: String,
pub description: String,
pub docs: String,
pub generator: String,
pub guid: String,
pub image: String,
pub language: String,
pub last_build_date: String,
pub link: String,
pub managing_editor: String,
pub pub_date: String,
pub title: String,
pub ttl: String,
pub webmaster: String,
pub items: Vec<RssItem>,
pub version: RssVersion,
}
Expand description
Represents the main structure for an 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.atom_link: String
The Atom link of the RSS feed.
The author of the RSS feed.
category: String
The category of the RSS feed.
copyright: String
The copyright notice for the content of the feed.
description: String
The description of the RSS feed.
docs: String
The docs link of the RSS feed.
generator: String
The generator of the RSS feed.
guid: String
The GUID of the RSS feed.
image: String
The image URL of the RSS feed.
language: String
The language of the RSS feed.
last_build_date: String
The last build date of the RSS feed.
link: String
The main link to the RSS feed.
managing_editor: String
The managing editor of the RSS feed.
pub_date: String
The publication date of the RSS feed.
title: String
The title of the RSS feed.
ttl: String
Time To Live (TTL), the number of minutes the feed should be cached before refreshing.
webmaster: String
The webmaster of the RSS feed.
items: Vec<RssItem>
A collection of additional items in the RSS feed.
version: RssVersion
The version of the RSS feed.
Implementations§
source§impl RssData
impl RssData
sourcepub fn new(version: Option<RssVersion>) -> Self
pub fn new(version: Option<RssVersion>) -> Self
sourcepub fn add_item(&mut self, item: RssItem)
pub fn add_item(&mut self, item: RssItem)
Adds an item to the RSS feed.
This method appends the given RssItem
to the items
vector of the RssData
struct.
§Arguments
item
- TheRssItem
to be added to the feed.
sourcepub fn remove_item(&mut self, guid: &str) -> bool
pub fn remove_item(&mut self, guid: &str) -> bool
sourcepub fn item_count(&self) -> usize
pub fn item_count(&self) -> usize
Returns the number of items in the RSS feed.
sourcepub fn clear_items(&mut self)
pub fn clear_items(&mut self)
Clears all items from the RSS feed.
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.
sourcepub fn to_hash_map(&self) -> HashMap<String, String>
pub fn to_hash_map(&self) -> HashMap<String, String>
Converts the RssData
into a HashMap<String, String>
for easier manipulation.
§Returns
A HashMap<String, String>
containing the RSS feed data.
sourcepub fn version(self, version: RssVersion) -> Self
pub fn version(self, version: RssVersion) -> Self
Sets the RSS version.
Sets the author.
sourcepub fn description<T: Into<String>>(self, value: T) -> Self
pub fn description<T: Into<String>>(self, value: T) -> Self
Sets the description.
sourcepub fn last_build_date<T: Into<String>>(self, value: T) -> Self
pub fn last_build_date<T: Into<String>>(self, value: T) -> Self
Sets the last build date.
sourcepub fn managing_editor<T: Into<String>>(self, value: T) -> Self
pub fn managing_editor<T: Into<String>>(self, value: T) -> Self
Sets the managing editor.
Trait Implementations§
source§impl<'de> Deserialize<'de> for RssData
impl<'de> Deserialize<'de> for RssData
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for RssData
impl StructuralPartialEq for RssData
Auto Trait Implementations§
impl Freeze for RssData
impl RefUnwindSafe for RssData
impl Send for RssData
impl Sync for RssData
impl Unpin for RssData
impl UnwindSafe for RssData
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)