pub fn generate_rss(options: &RssData) -> Result<String>
Expand description
Generates an RSS feed from the given RssData
struct.
This function creates a complete RSS feed in XML format based on the data contained in the provided RssData
.
It generates the feed according to the RSS version set in the RssData
.
§Arguments
options
- A reference to aRssData
struct containing the RSS feed data.
§Returns
Ok(String)
- The generated RSS feed as a string if successful.Err(RssError)
- An error if RSS generation fails.
§Errors
This function returns an error if there are issues in validating the RSS data or writing the RSS feed.
§Example
use rss_gen::{RssData, generate_rss, RssVersion};
let rss_data = RssData::new(Some(RssVersion::RSS2_0))
.title("My Blog")
.link("https://myblog.com")
.description("A blog about Rust programming");
match generate_rss(&rss_data) {
Ok(rss_feed) => println!("{}", rss_feed),
Err(e) => eprintln!("Error generating RSS: {}", e),
}