rs-histver
A library for querying Rust historical release versions (stable / beta / nightly) via the GitHub Releases API and rust-lang.org distribution server.
As a library: one function call, pure in-memory result, zero file-system side effects. As a CLI binary: local redb cache for offline queries, full terminal UI.
Library vs CLI
# Library only — no redb / clap dependency
= "0.3"
# Library + CLI binary
= { = "0.3", = ["cli"] }
Usage as a Library
use ;
async
FetchOptions — all fields are optional
| Method | Default | Description |
|---|---|---|
full_history(bool) |
false |
Stable: use RELEASES.md instead of GitHub API |
probe_days(u32) |
30 |
Beta/nightly: how many recent days to probe |
timeout(Duration) |
15s |
HTTP request timeout |
max_concurrency(usize) |
10 |
Maximum concurrent HTTP requests |
user_agent(string) |
rs-histver/{ver} |
HTTP User-Agent header |
Library API
| Item | Type | Description |
|---|---|---|
fetch_releases(channel, opts) |
async fn |
Fetch Vec<RustRelease> from remote |
FetchOptions |
struct |
Query configuration |
RustRelease |
struct |
{ version, date, channel } |
create_fetcher(channel, full, days) |
fn |
Low-level: create a typed fetcher |
ReleaseFetcher |
trait |
Strategy trait; implement to extend |
// Low-level API — use create_fetcher + ReleaseFetcher trait directly
use ;
let fetcher = create_fetcher?;
let network = NetworkConfig ;
let releases = fetcher.fetch.await?;
CLI Installation
Or build from source:
CLI Quick Start
# Sync stable releases to local cache
# Sync full stable history (all releases)
# Sync nightly releases from the last 30 days
# Sync beta releases from the last 14 days
# List cached releases
# Search releases
# Show cache statistics
CLI Commands
| Command | Description |
|---|---|
sync [-c CHANNEL] [--full] [-d DAYS] |
Fetch remote data and cache locally |
list [-c CHANNEL] [-n LIMIT] |
List cached releases |
search <KEYWORD> [-c CHANNEL] |
Fuzzy search by version or date |
info [-c CHANNEL] |
Show cache entry counts |
Global Options
| Option | Description |
|---|---|
--data-dir <PATH> |
Data directory for database files |
--db-file <NAME> |
Database filename |
--table-prefix <PREFIX> |
Table name prefix (default: rs_histver) |
--timeout <SECONDS> |
HTTP timeout (default: 15) |
--max-concurrency <N> |
Max concurrent requests (default: 10) |
Data Sources
| Channel | Default source | --full source |
|---|---|---|
| stable | GitHub Releases API | RELEASES.md (full history) |
| beta | dist/{date}/channel-rust-beta.toml probing |
— |
| nightly | dist/{date}/channel-rust-nightly.toml probing |
— |
Database (CLI only)
The CLI caches data in redb:
<executable_directory>/data/rs-histver.redb
Three per-channel tables ({prefix}_stable, {prefix}_beta, {prefix}_nightly) store
key-value pairs where key = date and value = version string.
Database Modes (CLI)
| Mode | Trigger | File |
|---|---|---|
| Standalone (default) | No --db-file |
<data_dir>/rs-histver.redb |
| Shared | --db-file set |
<data_dir>/<db_file> |
When db_file points to a non-redb file or the file is locked by another process,
the CLI automatically falls back to standalone mode.
Design Patterns
- Strategy Pattern:
ReleaseFetchertrait — each channel implements its own fetch logic - Factory Method:
create_fetcher()— creates the appropriate fetcher by channel name
License
Licensed under either of Apache License, Version 2.0 or MIT License at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.