pub struct PackageName(/* private fields */);Expand description
A package name is valid in these formats:
recipeA recipe on mandatory packagerecipe.pkgA recipe on “pkg” optional packagehost:recipeA recipe with host target on mandatory packagehost:recipe.pkgA recipe with host target on “pkg” optional packagetarget:recipeA recipe only for the target on mandatory package
Implementations§
Source§impl PackageName
impl PackageName
pub fn new(name: impl Into<String>) -> Result<Self, PackageError>
pub fn from_list(vec: Vec<impl Into<String>>) -> Result<Vec<Self>, PackageError>
pub fn as_str(&self) -> &str
Sourcepub fn without_host(&self) -> &str
pub fn without_host(&self) -> &str
Strip “host:” prefix if exists
Sourcepub fn without_target(&self) -> &str
pub fn without_target(&self) -> &str
Strip “target:” prefix if exists
Sourcepub fn without_prefix(&self) -> &str
pub fn without_prefix(&self) -> &str
Strip “host:” or “target:” prefix if exists
Sourcepub fn with_host(&self) -> PackageName
pub fn with_host(&self) -> PackageName
Add “host:” prefix if not exists
Sourcepub fn with_target(&self) -> PackageName
pub fn with_target(&self) -> PackageName
Add “target:” prefix if not exists
Sourcepub fn with_prefix(&self, os: PackagePrefix) -> PackageName
pub fn with_prefix(&self, os: PackagePrefix) -> PackageName
Add or replace os prefix
Sourcepub fn with_prefixed_suffix(&self, suffix: Option<&str>) -> PackageName
pub fn with_prefixed_suffix(&self, suffix: Option<&str>) -> PackageName
Add or replace pkg suffix. Retained the os prefix
Sourcepub fn with_suffix(&self, suffix: Option<&str>) -> PackageName
pub fn with_suffix(&self, suffix: Option<&str>) -> PackageName
Add or replace suffix. Does not retain the os prefix
Trait Implementations§
Source§impl Borrow<str> for PackageName
impl Borrow<str> for PackageName
Source§impl Clone for PackageName
impl Clone for PackageName
Source§fn clone(&self) -> PackageName
fn clone(&self) -> PackageName
Returns a duplicate of the value. Read more
1.0.0 · 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 PackageName
impl Debug for PackageName
Source§impl Default for PackageName
impl Default for PackageName
Source§fn default() -> PackageName
fn default() -> PackageName
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for PackageName
impl<'de> Deserialize<'de> for PackageName
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for PackageName
impl Display for PackageName
Source§impl From<PackageName> for String
impl From<PackageName> for String
Source§fn from(package_name: PackageName) -> Self
fn from(package_name: PackageName) -> Self
Converts to this type from the input type.
Source§impl Hash for PackageName
impl Hash for PackageName
Source§impl Ord for PackageName
impl Ord for PackageName
Source§fn cmp(&self, other: &PackageName) -> Ordering
fn cmp(&self, other: &PackageName) -> Ordering
1.21.0 · 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 PackageName
impl PartialEq for PackageName
Source§impl PartialOrd for PackageName
impl PartialOrd for PackageName
Source§impl Serialize for PackageName
impl Serialize for PackageName
Source§impl TryFrom<&OsStr> for PackageName
impl TryFrom<&OsStr> for PackageName
Source§impl TryFrom<&str> for PackageName
impl TryFrom<&str> for PackageName
Source§impl TryFrom<OsString> for PackageName
impl TryFrom<OsString> for PackageName
Source§impl TryFrom<String> for PackageName
impl TryFrom<String> for PackageName
impl Eq for PackageName
impl StructuralPartialEq for PackageName
Auto Trait Implementations§
impl Freeze for PackageName
impl RefUnwindSafe for PackageName
impl Send for PackageName
impl Sync for PackageName
impl Unpin for PackageName
impl UnsafeUnpin for PackageName
impl UnwindSafe for PackageName
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§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.