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-DDfor 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§
- InMemory
Feed Cache - 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§
- Feed
Cache - 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.