Struct alpm_types::Name
source · pub struct Name(String);
Expand description
A package name
Package names may contain the characters [a-z\d\-._@+]
, but must not
start with [-.]
.
§Examples
use alpm_types::{Name, Error};
use std::str::FromStr;
// create Name from &str
assert_eq!(
Name::from_str("test-123@.foo_+"),
Ok(Name::new("test-123@.foo_+".to_string()).unwrap())
);
assert_eq!(
Name::from_str(".test"),
Err(Error::InvalidName(".test".to_string()))
);
// format as String
assert_eq!("foo", format!("{}", Name::new("foo".to_string()).unwrap()));
Tuple Fields§
§0: String
Implementations§
Trait Implementations§
source§impl Ord for Name
impl Ord for Name
source§impl PartialEq for Name
impl PartialEq for Name
source§impl PartialOrd for Name
impl PartialOrd for Name
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 Name
impl StructuralPartialEq for Name
Auto Trait Implementations§
impl Freeze for Name
impl RefUnwindSafe for Name
impl Send for Name
impl Sync for Name
impl Unpin for Name
impl UnwindSafe for Name
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