pub struct EvrSortKey(/* private fields */);Expand description
Encode an EVR (epoch, version, release) as a memcmp-sortable binary key.
The returned Vec<u8> produces correct RPM version ordering when compared
byte-by-byte, matching the semantics of rpmvercmp().
This property is extremely useful, because it means that the value can be stored in a database and used to perform in-database RPM version comparisons, provided the database is capable of memcmp-style order comparisons across collections of raw bytes.
The key layout is: [4-byte big-endian epoch] [version sortkey] [release sortkey]
Empty or unparseable epochs are treated as 0, matching RPM semantics.
Implementations§
Source§impl EvrSortKey
impl EvrSortKey
Sourcepub fn from_values(epoch: &str, version: &str, release: &str) -> Self
pub fn from_values(epoch: &str, version: &str, release: &str) -> Self
Create a sortkey from individual epoch, version, and release strings.
Trait Implementations§
Source§impl AsRef<[u8]> for EvrSortKey
impl AsRef<[u8]> for EvrSortKey
Source§impl Clone for EvrSortKey
impl Clone for EvrSortKey
Source§fn clone(&self) -> EvrSortKey
fn clone(&self) -> EvrSortKey
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for EvrSortKey
impl Debug for EvrSortKey
Source§impl From<EvrSortKey> for Vec<u8>
impl From<EvrSortKey> for Vec<u8>
Source§fn from(k: EvrSortKey) -> Self
fn from(k: EvrSortKey) -> Self
Converts to this type from the input type.
Source§impl Hash for EvrSortKey
impl Hash for EvrSortKey
Source§impl Ord for EvrSortKey
impl Ord for EvrSortKey
Source§fn cmp(&self, other: &EvrSortKey) -> Ordering
fn cmp(&self, other: &EvrSortKey) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for EvrSortKey
impl PartialEq for EvrSortKey
Source§fn eq(&self, other: &EvrSortKey) -> bool
fn eq(&self, other: &EvrSortKey) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl PartialOrd for EvrSortKey
impl PartialOrd for EvrSortKey
impl Eq for EvrSortKey
impl StructuralPartialEq for EvrSortKey
Auto Trait Implementations§
impl Freeze for EvrSortKey
impl RefUnwindSafe for EvrSortKey
impl Send for EvrSortKey
impl Sync for EvrSortKey
impl Unpin for EvrSortKey
impl UnsafeUnpin for EvrSortKey
impl UnwindSafe for EvrSortKey
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more