Module rss
http and rss only.Expand description
RSS 2.0 and Atom 1.0 feed support.
§Building feeds
Both formats use type-state builders that enforce required fields at
compile time. Call .build() only after all required fields are set.
use rama_http::protocols::rss::{Rss2Feed, Rss2Item, Rss2Guid};
let feed = Rss2Feed::builder()
.title("My Blog")
.link("https://example.com")
.description("Latest posts")
.item(
Rss2Item::new()
.with_title("Hello World")
.with_guid(Rss2Guid::permalink("https://example.com/1")),
)
.build();§Serving feeds
All feed types implement IntoResponse. The correct Content-Type
header (application/rss+xml or application/atom+xml) is set
automatically.
§Parsing feeds
Use Feed::from_body (or FeedStream::from_body for true streaming
item-by-item processing) to parse a feed from an HTTP response. There is
no sync top-level parser — everything goes through the async streaming
reader.
§Streaming
Rss2StreamWriter and AtomStreamWriter wrap an async item stream and
produce a streaming Body without buffering the full document.
§Extensions
All extension fields are in the feed_ext sub-module. Items expose
inherent shortcuts (.itunes(), .podcast(), .dublin_core(),
.content(), .media(), .podlove()) for the six supported
namespaces: iTunes, Podcasting 2.0, Dublin Core, content:encoded,
Media RSS, and Podlove Simple Chapters (item-level only).
Modules§
- feed_
ext - RSS/Atom feed extension system.
Structs§
- Atom
Category - An Atom category element.
- Atom
Content - An Atom
<content>element. - Atom
Entry - An Atom entry.
- Atom
Feed - An Atom feed.
- Atom
Feed Builder - Type-state builder for
AtomFeed. - Atom
Feed Stream - Async streaming reader for an Atom 1.0 feed.
- Atom
Generator - An Atom generator element.
- Atom
Header - Feed-level metadata of an Atom 1.0 document — everything an
AtomFeedcarries except itsentries. - Atom
Link - An Atom link element.
- Atom
Person - An Atom person construct.
- Atom
Source - An Atom source element (entry’s original feed metadata).
- Atom
Stream Writer - Strongly-typed Atom 1.0 stream writer. Mirror of
Rss2StreamWriter. - Atom
Text - Atom text construct: a string body plus a
AtomTextKindthat says how to interpret/serialize it. Equivalent of the spec’s “Text Construct” (RFC 4287 §3.1). - Collect
Error - Returned by
Rss2FeedStream::collect,AtomFeedStream::collectandFeedStream::collectwhen an item / entry fails to parse partway through the stream. Thepartialfeed holds the header that was parsed at stream construction and every item / entry that succeeded before the failure, so callers can keep what’s salvageable. - Content
content:encodedextension — carries full HTML/XHTML body for a feed item.- Dublin
Core - Dublin Core extension fields for a feed item.
- Dublin
Core Feed - Dublin Core extension fields at the feed (channel) level.
- Enclosure
View - Normalised view over an enclosure: RSS
<enclosure>and Atom<link rel="enclosure">collapse to the same(url, length, mime)shape.lengthandmimeare required by RSS but optional in Atom. - Feed
Extensions - Extension container for feeds (channel-level for RSS 2.0, feed-level for Atom).
- Feed
Parse Error - Returned when the document cannot be turned into a feed at all — either nothing recognisable as an RSS 2.0 / Atom 1.0 root was seen, or strict mode rejected a structural violation in the header.
- Feed
Stream Writer - Format-agnostic stream writer. Use this when the caller has a
Feed(often from asuper::FeedStream::collect) and wants to re-emit it without first checking which variant it is. Internally type-erased into aBoxStream<Bytes>. - ITunes
- iTunes extension fields for a single podcast episode item.
- ITunes
Feed - iTunes extension fields at the feed (channel) level.
- Item
Extensions - Extension container for feed items (RSS 2.0 items and Atom entries).
- Media
Content - A single
media:contentelement. - Media
Rss - Media RSS extension for a feed item.
- Media
Thumbnail - A
media:thumbnailelement. - Podcast
- Podcasting 2.0 extension fields for a single episode item.
- Podcast
Chapters - A
podcast:chaptersreference. - Podcast
Episode - A
podcast:episodeelement. - Podcast
Feed - Podcasting 2.0 extension fields at the feed (channel) level.
- Podcast
Funding - A
podcast:fundingelement (feed-level). - Podcast
Location - A
podcast:locationelement. - Podcast
Person - A
podcast:personelement (used at both item and feed level). - Podcast
Remote Item - A
podcast:remoteItemelement (feed-level). - Podcast
Season - A
podcast:seasonelement. - Podcast
Soundbite - A
podcast:soundbiteelement. Podcasting 2.0 spec uses decimal seconds for both start and duration (sub-second precision is meaningful). - Podcast
Trailer - A
podcast:trailerelement (feed-level). - Podcast
Transcript - A
podcast:transcriptelement. - Podlove
Chapter - A single
<psc:chapter>element. - Podlove
Chapters - A
<psc:chapters>element. Item-level only (a chapter list applies to a single episode). - Rss2
Category - RSS 2.0 category element.
- Rss2
Channel - Channel-level metadata of an RSS 2.0 feed — everything an
Rss2Feedcarries except itsitems. Re-combine with item events viaRss2Channel::into_feed_with_items. - Rss2
Enclosure - RSS 2.0 enclosure element.
- Rss2
Feed - An RSS 2.0 feed.
- Rss2
Feed Builder - Type-state builder for
Rss2Feed. - Rss2
Feed Stream - Async streaming reader for an RSS 2.0 feed.
- Rss2
Guid - RSS 2.0 guid element.
- Rss2
Image - RSS 2.0 image element.
- Rss2
Item - An RSS 2.0 channel item.
- Rss2
Source - RSS 2.0 source element.
- Rss2
Stream Writer - Strongly-typed RSS 2.0 stream writer.
Enums§
- Atom
Text Kind - Which Atom
type=attribute applies to anAtomText. - Feed
- A feed in either RSS 2.0 or Atom 1.0 format.
- Feed
Item - One item or entry, regardless of the originating feed format. Yielded by
FeedStreamwhen iterated as aStream; convert into a strongly-typedRss2Item/AtomEntrywith the obviousmatch, or use the cross-format accessors directly on this enum. - Feed
Stream - One async stream per supported feed format. Use
FeedStream::newwhen the input format isn’t known ahead of time, orRss2FeedStream/AtomFeedStreamdirectly when it is.
Type Aliases§
- Atom
Collect Error - Per-format convenience alias.
- Feed
Collect Error - Format-agnostic alias.
- Rss2
Collect Error - Per-format convenience alias.