Struct alpm_types::Pkgrel
source · pub struct Pkgrel(String);
Expand description
A pkgrel of a package
Pkgrel is used to indicate the build version of a package and is appended to a version, delimited by a "-"
(e.g.
-2
is added to 1.0.0
to form 1.0.0-2
which then orders newer than 1.0.0-1
).
A Pkgrel wraps a String which is guaranteed to not start with a "0"
, to contain only numeric characters
(optionally delimited by a single "."
, which must be followed by at least one non-"0"
numeric character).
§Examples
use std::str::FromStr;
use alpm_types::Pkgrel;
assert!(Pkgrel::new("1".to_string()).is_ok());
assert!(Pkgrel::new("1.1".to_string()).is_ok());
assert!(Pkgrel::new("0".to_string()).is_err());
assert!(Pkgrel::new("0.1".to_string()).is_err());
assert!(Pkgrel::new("1.0".to_string()).is_err());
Tuple Fields§
§0: String
Implementations§
Trait Implementations§
source§impl Ord for Pkgrel
impl Ord for Pkgrel
source§impl PartialEq for Pkgrel
impl PartialEq for Pkgrel
source§impl PartialOrd for Pkgrel
impl PartialOrd for Pkgrel
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
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 moreimpl Eq for Pkgrel
impl StructuralPartialEq for Pkgrel
Auto Trait Implementations§
impl Freeze for Pkgrel
impl RefUnwindSafe for Pkgrel
impl Send for Pkgrel
impl Sync for Pkgrel
impl Unpin for Pkgrel
impl UnwindSafe for Pkgrel
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