Skip to main content

Module news

Module news 

Source
Expand description

News module for Arch Linux news and security advisories.

This module provides:

  • Arch news — fetch and parse the official news RSS feed (https://archlinux.org/feeds/news/)
  • Security advisories — fetch and parse the advisory Atom feed (https://security.archlinux.org/advisory/feed.atom)
  • Date normalization — feed dates (RFC 2822 / RFC 3339 / ISO 8601) normalized to YYYY-MM-DD for lexicographic sorting

Parse functions are pure (no network), so applications can test against recorded feeds. Fetch functions take a caller-provided reqwest::Client, keeping timeouts, user agent, and fetch cadence under caller control.

§Features

This module requires the news feature flag:

[dependencies]
arch-toolkit = { version = "0.2", features = ["news"] }

§Examples

§Fetch Recent News

use arch_toolkit::news::fetch_arch_news;

let client = reqwest::Client::new();
let items = fetch_arch_news(&client, 10, None).await?;
for item in items {
    println!("{} {}", item.date, item.title);
}

§Fetch Security Advisories Since a Date

use arch_toolkit::news::fetch_security_advisories;

let client = reqwest::Client::new();
let advisories = fetch_security_advisories(&client, 50, Some("2026-01-01")).await?;
for advisory in advisories {
    println!("{} [{}] {}", advisory.date, advisory.severity, advisory.title);
}

§Parse a Recorded Feed (no network)

use arch_toolkit::news::parse_arch_news_rss;

let rss = "<item><title>Update</title><link>https://archlinux.org/news/u/</link>\
           <pubDate>Thu, 21 Aug 2025 12:00:00 +0000</pubDate></item>";
let items = parse_arch_news_rss(rss, 10, None);
assert_eq!(items[0].date, "2025-08-21");

Re-exports§

pub use crate::types::news::AdvisorySeverity;
pub use crate::types::news::ArchNewsItem;
pub use crate::types::news::SecurityAdvisory;

Structs§

InMemoryFeedCache
What: Provide a small deterministic in-memory implementation of FeedCache.

Constants§

ADVISORY_FEED_URL
URL of the official Arch Linux security advisory Atom feed.
ARCH_NEWS_FEED_URL
URL of the official Arch Linux news RSS feed.
MAX_ARTICLE_HTML_BYTES
Maximum HTML response size accepted for one article extraction.
MAX_ARTICLE_TEXT_BYTES
Maximum text size emitted from one article extraction.
MAX_FEED_RESPONSE_BYTES
Maximum response size accepted for a raw news or advisory feed payload.

Traits§

FeedCache
What: Define caller-owned storage for raw news and advisory feed payloads.

Functions§

extract_article_text
What: Extract readable text from a bounded HTML news article.
fetch_arch_news
What: Fetch recent Arch Linux news from the official feed URL.
fetch_arch_news_cached
What: Fetch official Arch news with an optional caller-owned feed cache.
fetch_arch_news_cached_from
What: Fetch caller-specified Arch news with an optional generic feed cache.
fetch_arch_news_from
What: Fetch and parse Arch news from a caller-specified feed URL.
fetch_article_text
What: Fetch one article through a caller-provided client and extract its text.
fetch_security_advisories
What: Fetch recent security advisories from the official Atom feed URL.
fetch_security_advisories_cached
What: Fetch official security advisories with an optional generic feed cache.
fetch_security_advisories_cached_from
What: Fetch caller-specified advisories with an optional generic feed cache.
fetch_security_advisories_from
What: Fetch and parse advisories from a caller-specified Atom URL.
normalize_feed_date
What: Normalize a feed date string to YYYY-MM-DD.
parse_advisories_atom
What: Parse security advisory Atom content into advisories.
parse_arch_news_rss
What: Parse Arch Linux news RSS content into news items.