Skip to main content

RustRelease

Struct RustRelease 

Source
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: V

The 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: C

Arbitrary extra data

Implementations§

Source§

impl<V: Debug> RustRelease<V, ()>

Source

pub fn new( version: V, release_date: Option<Date>, toolchains: impl IntoIterator<Item = Toolchain>, ) -> Self

Create a new RustRelease instance using a version, optionally a release date, and an iterator of toolchains.

Source§

impl<V: Debug, C> RustRelease<V, C>

Source

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.

Source

pub fn version(&self) -> &V

A shared reference to version of a release.

§See also

Commonly V is parameterized by one of these:

Source

pub fn version_mut(&mut self) -> &mut V

An exclusive reference to version of a release.

§See also

Commonly V is parameterized by one of these:

Source

pub fn release_date(&self) -> Option<&Date>

A shared reference to the release date of a release, if set.

Source

pub fn release_date_mut(&mut self) -> Option<&mut Date>

An exclusive reference to the release date of a release, if set.

Source

pub fn toolchains(&self) -> &Vec<Toolchain>

A shared reference to the toolchains associated with the release.

Source

pub fn toolchains_mut(&mut self) -> &mut Vec<Toolchain>

An exclusive reference to the toolchains associated with the release.

Source

pub fn toolchains_iter(&self) -> impl Iterator<Item = &Toolchain>

Iterator over the toolchains associated with the release.

Source

pub fn context(&self) -> &C

A shared reference to the (added) context of this release.

Source

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>

Source§

fn clone(&self) -> RustRelease<V, C>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<V: Debug + Debug, C: Debug> Debug for RustRelease<V, C>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<V: Ord + Debug, C> Ord for RustRelease<V, C>

Source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl<V: PartialEq + Debug, C> PartialEq for RustRelease<V, C>

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<V: PartialOrd + Debug, C> PartialOrd for RustRelease<V, C>

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<V: Eq + Debug, C> Eq for RustRelease<V, C>

Auto Trait Implementations§

§

impl<V, C> Freeze for RustRelease<V, C>
where V: Freeze, C: Freeze,

§

impl<V, C> RefUnwindSafe for RustRelease<V, C>

§

impl<V, C> Send for RustRelease<V, C>
where V: Send, C: Send,

§

impl<V, C> Sync for RustRelease<V, C>
where V: Sync, C: Sync,

§

impl<V, C> Unpin for RustRelease<V, C>
where V: Unpin, C: Unpin,

§

impl<V, C> UnsafeUnpin for RustRelease<V, C>
where V: UnsafeUnpin, C: UnsafeUnpin,

§

impl<V, C> UnwindSafe for RustRelease<V, C>
where V: UnwindSafe, C: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.