Crate rust_releases[][src]

This crate aims to provide an index of Rust releases, and make it available to Rust programs.

Introduction

The Rust programming language uses deterministic versioning for toolchain releases. Stable versions use SemVer, while nightly, beta and historical builds can be accessed by using dated builds (YY-MM-DD).

Unfortunately, a complete index of releases is not available any more. There are however a few places where we can find partial release indices, from which we can build our own index.

This process consists of two parts: 1) obtaining the data sources, and 2) building the index from these data sources. For the first part this crate provides the FetchResources trait, and for the second part the crate provides the Source trait.

These traits are implemented for certain index strategies:

  1. RustDistWithCLI: Build an index from the AWS S3 Rust distribution bucket; obtain the input data yourself using the aws cli.
  2. ChannelManifests: Build an index from Rust release manifests.
  3. RustChangelog: Build an index from the RELEASES.md found in the root of the Rust source code repository.
  4. RustDist: Build an index from the AWS S3 Rust distribution bucket; input data can be obtained using the FetchResources trait.

In the below example, we chose the third source type, and we’ll use it to show you how you can use this library.

Example

use rust_releases::{FetchResources, Source, Channel, ReleaseIndex};
use rust_releases::source::RustChangelog;

// We choose the RustChangelog source for this example; alternatives are RustDistWithCLI and ChannelManifests
let source = RustChangelog::fetch_channel(Channel::Stable).unwrap();

// Build a release index using our source of choice
let index = ReleaseIndex::from_source(source).unwrap();

// Do something with the release information
index.releases()
    .iter()
    .for_each(|release| {
        println!("release {:?}", release)
    });

Implemented features

Type of data source Trait Implemented Channels1 Speed2, 3 On disk cache size4 Notes
ChannelManifests Source Stable, Beta & NightlyTo be implemented Medium - Input data has not been updated since 2020-02-23 (#9). Use RustDist instead.
FetchResources Extremely slow (~1 hour) ~418 MB
RustChangelog Source Stable Fast -
FetchResources Instant (<1 second) ~491 KB
RustDist Source Stable, Beta & NightlyTo be implemented Fast -
FetchResources Medium fast (~20 seconds) ~1 MB
RustDistWithCLI Source Stable, Beta & Nightly Fast -
FetchResources Slow (~1 minute) ~8 MB

1: Currently most of the rust-releases public API supports only stable. Support for the beta and nightly channel is work-in-progress, and the table currently lists whether there is theoretical support for these channels.
2: Speed for the Source trait primarily consist of parsing speed
3: Speed for the FetchResources trait is primarily limited by your own download speed, and the rate limiting of the server from which the resources are fetched
4: Approximate as of 2021-03-03

Issues

Feel free to open an issue at our repository for questions, feature requests, bug fixes, or other points of feedback 🤗.

Re-exports

pub use crate::channel::Channel;
pub use crate::errors::RustReleasesError;
pub use crate::errors::TResult;
pub use crate::index::Release;
pub use crate::index::ReleaseIndex;
pub use crate::source::FetchResources;
pub use crate::source::Source;
pub use semver;

Modules

channel

See Channel, enumerates the Rust release channels.

errors

Top level rust-releases errors

index

Module which provides the Rust releases index which is produced by a strategy. See ReleaseIndex and Release

source

Module which contains multiple types of sources and the methods necessary to transform those sources into a ReleaseIndex.