Struct pep508_rs::PackageName
source · pub struct PackageName(/* private fields */);
Expand description
The normalized name of a package.
Converts the name to lowercase and collapses any run of the characters -
, _
and .
down to a single -
, e.g., ---
, .
, and __
all get converted to just -
.
See: https://packaging.python.org/en/latest/specifications/name-normalization/
Implementations§
source§impl PackageName
impl PackageName
sourcepub fn new(name: String) -> Result<Self, InvalidNameError>
pub fn new(name: String) -> Result<Self, InvalidNameError>
Create a validated, normalized package name.
sourcepub fn as_dist_info_name(&self) -> Cow<'_, str>
pub fn as_dist_info_name(&self) -> Cow<'_, str>
Escape this name with underscores (_
) instead of dashes (-
)
Trait Implementations§
source§impl AsRef<str> for PackageName
impl AsRef<str> for PackageName
source§impl Clone for PackageName
impl Clone for PackageName
source§fn clone(&self) -> PackageName
fn clone(&self) -> PackageName
Returns a copy 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 Display for PackageName
impl Display for PackageName
source§impl From<&PackageName> for PackageName
impl From<&PackageName> for PackageName
source§fn from(package_name: &PackageName) -> Self
fn from(package_name: &PackageName) -> Self
Required for WaitMap::wait
.
source§impl FromStr for PackageName
impl FromStr for PackageName
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§fn eq(&self, other: &PackageName) -> bool
fn eq(&self, other: &PackageName) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd for PackageName
impl PartialOrd for PackageName
source§fn partial_cmp(&self, other: &PackageName) -> Option<Ordering>
fn partial_cmp(&self, other: &PackageName) -> Option<Ordering>
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 PackageName
impl StructuralPartialEq for PackageName
Auto Trait Implementations§
impl RefUnwindSafe for PackageName
impl Send for PackageName
impl Sync for PackageName
impl Unpin 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