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).
Re-exports§
pub use feed_ext::Content;pub use feed_ext::DublinCore;pub use feed_ext::DublinCoreFeed;pub use feed_ext::FeedExtensions;pub use feed_ext::ITunes;pub use feed_ext::ITunesFeed;pub use feed_ext::ItemExtensions;pub use feed_ext::MediaContent;pub use feed_ext::MediaRss;pub use feed_ext::MediaThumbnail;pub use feed_ext::Podcast;pub use feed_ext::PodcastAlternateEnclosure;pub use feed_ext::PodcastChapters;pub use feed_ext::PodcastEpisode;pub use feed_ext::PodcastFeed;pub use feed_ext::PodcastFunding;pub use feed_ext::PodcastIntegrity;pub use feed_ext::PodcastLocation;pub use feed_ext::PodcastPerson;pub use feed_ext::PodcastRemoteItem;pub use feed_ext::PodcastSeason;pub use feed_ext::PodcastSoundbite;pub use feed_ext::PodcastSource;pub use feed_ext::PodcastTrailer;pub use feed_ext::PodcastTranscript;pub use feed_ext::PodloveChapter;pub use feed_ext::PodloveChapters;
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. - 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
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>. - 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. - Item
IdView - Normalised view over an item identifier. RSS GUID values are opaque strings, while Atom IDs are URI values.
Type Aliases§
- Atom
Collect Error - Per-format convenience alias.
- Feed
Collect Error - Format-agnostic alias.
- Rss2
Collect Error - Per-format convenience alias.