pub struct RustRelease<V: Debug, C = ()> {
pub version: V,
pub release_date: Option<Date>,
pub toolchains: Vec<Toolchain>,
pub context: C,
}Expand description
Type to model a Rust release.
§PartialEq, Eq, Ord, PartialOrd
With respect to the PartialEq, Eq, PartialOrd and Ord traits, a RustRelease
a is equal, less, or greater than a RustRelease b iff respectively the
a.version field is equal, less, or greater than b.version.
Fields§
§version: VThe version of a RustRelease.
The versioning scheme depends on the channel, which is why the version
type is a generic. In this library, the V is always substituted by one
of the following types: Stable, Beta or Nightly.
Stable and Beta carry a semver version number, while Nightly
is versioned by a date.
release_date: Option<Date>The release date of the release.
The field is optional, because the value may be absent from a data source.
toolchains: Vec<Toolchain>The toolchains associated with the release.
The field may be empty if toolchains were absent from a data source.
context: CArbitrary extra data
Implementations§
Source§impl<V: Debug> RustRelease<V, ()>
impl<V: Debug> RustRelease<V, ()>
Source§impl<V: Debug, C> RustRelease<V, C>
impl<V: Debug, C> RustRelease<V, C>
Sourcepub fn new_with_context(
version: V,
release_date: Option<Date>,
toolchains: impl IntoIterator<Item = Toolchain>,
context: C,
) -> Self
pub fn new_with_context( version: V, release_date: Option<Date>, toolchains: impl IntoIterator<Item = Toolchain>, context: C, ) -> Self
Create a new RustRelease instance using a version, optionally a release date, an iterator of toolchains and an “arbitrary” context.
The context is can contain any additional data you want to store with the previously mentioned data fields, i.e. the version, release date and toolchains. For example, you could add a struct which contains metadata about when and where the data was fetched from, or which contains checksums or signatures.
Sourcepub fn version_mut(&mut self) -> &mut V
pub fn version_mut(&mut self) -> &mut V
Sourcepub fn release_date(&self) -> Option<&Date>
pub fn release_date(&self) -> Option<&Date>
A shared reference to the release date of a release, if set.
Sourcepub fn release_date_mut(&mut self) -> Option<&mut Date>
pub fn release_date_mut(&mut self) -> Option<&mut Date>
An exclusive reference to the release date of a release, if set.
Sourcepub fn toolchains(&self) -> &Vec<Toolchain>
pub fn toolchains(&self) -> &Vec<Toolchain>
A shared reference to the toolchains associated with the release.
Sourcepub fn toolchains_mut(&mut self) -> &mut Vec<Toolchain>
pub fn toolchains_mut(&mut self) -> &mut Vec<Toolchain>
An exclusive reference to the toolchains associated with the release.
Sourcepub fn toolchains_iter(&self) -> impl Iterator<Item = &Toolchain>
pub fn toolchains_iter(&self) -> impl Iterator<Item = &Toolchain>
Iterator over the toolchains associated with the release.
Sourcepub fn context_mut(&mut self) -> &mut C
pub fn context_mut(&mut self) -> &mut C
An exclusive reference to the (added) context of this release.
Trait Implementations§
Source§impl<V: Clone + Debug, C: Clone> Clone for RustRelease<V, C>
impl<V: Clone + Debug, C: Clone> Clone for RustRelease<V, C>
Source§fn clone(&self) -> RustRelease<V, C>
fn clone(&self) -> RustRelease<V, C>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more