Struct rpm::Evr

source ·
pub struct Evr<'a> { /* private fields */ }
Expand description

A full RPM “version” specifier has 3 different components - Epoch, Version, and Release.

You are not expected to create these manually, but rather from existing RPMs.

Epoch overrides all other fields and is generally only used as a last resort - in cases where a change to the versioning scheme or packaging error creates a situation where newer packages might otherwise sort as being older.

Version is the normal version string used by the upstream project. This shouldn’t be tweaked by the packager.

Release indicates firstly the number of times this package has been released - for instance, with custom patches and backports not present in the upstream, but may also indicate other details such as the OS it was built for (fc38, el9) or portions of a git commit hash.

Tilde (~) and caret (^) are special values used in particular situations. Including ~ in a version is used for denoting pre-releases and will force it to sort as less than a version without a caret, e.g. 0.5.0 vs 0.5.0~rc1. Including ^ in a version is used for denoting snapshots not directly associated with an upstream release and will force it to sort higher, e.g. 0.5.0 vs 0.5.0^deadbeef

Implementations§

source§

impl<'a> Evr<'a>

source

pub fn new<T: Into<Cow<'a, str>>>(epoch: T, version: T, release: T) -> Evr<'a>

Create a new EVR

source

pub fn parse(evr: &'a str) -> Self

Create an EVR parsed from a string

source

pub fn epoch(&self) -> &str

The epoch value

source

pub fn version(&self) -> &str

The version value

source

pub fn release(&self) -> &str

The release value

source

pub fn as_normalized_form(&self) -> String

Write an EVR string in a normalized form which always includes an epoch

The standard string representation of an EVR will ignore the epoch if not set. A package having no epoch value is equivalent to having an epoch of zero. Sometimes it is useful to write NEVRAs in a form such that equivalent values are represented identically, therefore, this “normalized” form will always include it.

source

pub fn values(&self) -> (&str, &str, &str)

Return the epoch, version and release values as a 3-element tuple

source

pub fn parse_values(evr: &'a str) -> (&'a str, &'a str, &'a str)

Parse the epoch, version and release values and return them as a 3-element tuple

Trait Implementations§

source§

impl<'a> Clone for Evr<'a>

source§

fn clone(&self) -> Evr<'a>

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl<'a> Debug for Evr<'a>

source§

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

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

impl<'a> Default for Evr<'a>

source§

fn default() -> Evr<'a>

Returns the “default value” for a type. Read more
source§

impl<'a> Display for Evr<'a>

source§

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

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

impl<'a> From<(&'a str, &'a str, &'a str)> for Evr<'a>

source§

fn from(val: (&'a str, &'a str, &'a str)) -> Self

Converts to this type from the input type.
source§

impl<'a> Ord for Evr<'a>

source§

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

This method returns an Ordering between self and other. Read more
1.21.0 · source§

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

Compares and returns the maximum of two values. Read more
1.21.0 · source§

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

Compares and returns the minimum of two values. Read more
1.50.0 · source§

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

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

impl<'a> PartialEq for Evr<'a>

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a> PartialOrd for Evr<'a>

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 · source§

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

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

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

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<'a> Eq for Evr<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for Evr<'a>

§

impl<'a> RefUnwindSafe for Evr<'a>

§

impl<'a> Send for Evr<'a>

§

impl<'a> Sync for Evr<'a>

§

impl<'a> Unpin for Evr<'a>

§

impl<'a> UnwindSafe for Evr<'a>

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§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

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

§

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> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

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

§

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>,

§

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.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V