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 std::str::FromStr;
use alpm_types::{Error, Name};
// create Name from &str
assert_eq!(
Name::from_str("test-123@.foo_+"),
Ok(Name::new("test-123@.foo_+".to_string()).unwrap())
);
assert!(Name::from_str(".test").is_err());
// 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 PartialOrd for Name
impl PartialOrd for Name
impl 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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)