Struct alpm_types::Pkgver
source · pub struct Pkgver(String);
Expand description
A pkgver of a package
Pkgver is used to denote the upstream version of a package.
A Pkgver wraps a String
, which is guaranteed to only contain alphanumeric characters, "_"
, "+"
or "."
, but
to not start with a "_"
, a "+"
or a "."
character and to be at least one char long.
NOTE: This implementation of Pkgver is stricter than that of libalpm/pacman. It does not allow empty strings ""
,
or chars that are not in the allowed set, or "."
as the first character.
§Examples
use std::str::FromStr;
use alpm_types::Pkgver;
assert!(Pkgver::new("1".to_string()).is_ok());
assert!(Pkgver::new("1.1".to_string()).is_ok());
assert!(Pkgver::new("foo".to_string()).is_ok());
assert!(Pkgver::new("0".to_string()).is_ok());
assert!(Pkgver::new(".0.1".to_string()).is_err());
assert!(Pkgver::new("_1.0".to_string()).is_err());
assert!(Pkgver::new("+1.0".to_string()).is_err());
Tuple Fields§
§0: String
Implementations§
Trait Implementations§
source§impl Ord for Pkgver
impl Ord for Pkgver
source§impl PartialEq for Pkgver
impl PartialEq for Pkgver
source§impl PartialOrd for Pkgver
impl PartialOrd for Pkgver
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 Pkgver
Auto Trait Implementations§
impl Freeze for Pkgver
impl RefUnwindSafe for Pkgver
impl Send for Pkgver
impl Sync for Pkgver
impl Unpin for Pkgver
impl UnwindSafe for Pkgver
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