Crate rss_gen

source
Expand description

§RSS Gen

rss-gen is a comprehensive Rust library for generating, parsing, serializing, and deserializing RSS feeds. It supports multiple RSS versions, providing flexibility for creating and handling feeds across different formats.

§Features

  • Support for RSS versions 0.90, 0.91, 0.92, 1.0, and 2.0
  • Generation of RSS feeds from structured data
  • Parsing of existing RSS feeds into structured data
  • Serialization and deserialization of RSS data
  • Extensible elements for managing standard and optional RSS fields
  • Atom link support for modern syndication compatibility
  • Image embedding for RSS 2.0 feeds

§Examples

§Generating an RSS 2.0 feed

use rss_gen::{RssData, RssVersion, generate_rss};

let rss_data = RssData::new(Some(RssVersion::RSS2_0))
    .title("My Rust Blog")
    .link("https://myrustblog.com")
    .description("A blog about Rust programming and tutorials.");

match generate_rss(&rss_data) {
    Ok(rss_feed) => println!("Generated RSS feed: {}", rss_feed),
    Err(e) => eprintln!("Error generating RSS feed: {}", e),
}

§Parsing an existing RSS feed

use rss_gen::parse_rss;

let rss_content = r#"
    <?xml version="1.0" encoding="UTF-8"?>
    <rss version="2.0">
        <channel>
            <title>My Rust Blog</title>
            <link>https://myrustblog.com</link>
            <description>A blog about Rust programming and tutorials.</description>
        </channel>
    </rss>
"#;

match parse_rss(rss_content) {
    Ok(parsed_data) => println!("Parsed RSS data: {:?}", parsed_data),
    Err(e) => eprintln!("Error parsing RSS feed: {}", e),
}

Re-exports§

Modules§

  • Contains the main types and data structures used to represent RSS feeds.
  • Defines error types used throughout the library.
  • Implements RSS feed generation functionality.
  • Provides procedural macros for simplifying RSS operations. This module provides macros for generating RSS feeds and setting fields for RSS data.
  • Implements RSS feed parsing functionality.
  • Provides utilities for validating RSS feeds.

Macros§

Constants§

  • The current version of the rss-gen crate.

Functions§

  • A convenience function to generate a minimal valid RSS 2.0 feed.