Struct packageurl::PackageUrl
source · pub struct PackageUrl<'a> { /* private fields */ }
Expand description
A Package URL.
Implementations§
source§impl<'a> PackageUrl<'a>
impl<'a> PackageUrl<'a>
sourcepub fn new<T, N>(ty: T, name: N) -> Result<Self>
pub fn new<T, N>(ty: T, name: N) -> Result<Self>
Create a new Package URL with the provided type and name.
§Type
The Package URL type must be valid, otherwise an error will be returned. The type can only be composed of ASCII letters and numbers, ‘.’, ‘+’ and ‘-’ (period, plus and dash). It cannot start with a number and cannot contain spaces.
§Name
The package name will be canonicalize depending on the type: for instance, ‘bitbucket’ packages have a case-insensitive name, so the name will be lowercased if needed.
§Example
assert!( packageurl::PackageUrl::new("cargo", "packageurl").is_ok() );
assert!( packageurl::PackageUrl::new("bad type", "packageurl").is_err() );
sourcepub fn with_namespace<N>(&mut self, namespace: N) -> &mut Self
pub fn with_namespace<N>(&mut self, namespace: N) -> &mut Self
Assign a namespace to the package.
sourcepub fn without_namespace(&mut self) -> &mut Self
pub fn without_namespace(&mut self) -> &mut Self
Clear the namespace
sourcepub fn with_version<V>(&mut self, version: V) -> &mut Self
pub fn with_version<V>(&mut self, version: V) -> &mut Self
Assign a version to the package.
sourcepub fn without_version(&mut self) -> &mut Self
pub fn without_version(&mut self) -> &mut Self
Clear the version
sourcepub fn with_subpath<S>(&mut self, subpath: S) -> Result<&mut Self>
pub fn with_subpath<S>(&mut self, subpath: S) -> Result<&mut Self>
Assign a subpath to the package.
Subpaths must not contain empty, local (‘.’) or parent (‘..’) segments, otherwise an error will be returned.
sourcepub fn without_subpath(&mut self) -> &mut Self
pub fn without_subpath(&mut self) -> &mut Self
Clear the subpath
sourcepub fn clear_qualifiers(&mut self) -> &mut Self
pub fn clear_qualifiers(&mut self) -> &mut Self
Clear qualifiers
Trait Implementations§
source§impl<'a> Clone for PackageUrl<'a>
impl<'a> Clone for PackageUrl<'a>
source§fn clone(&self) -> PackageUrl<'a>
fn clone(&self) -> PackageUrl<'a>
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<'a> Debug for PackageUrl<'a>
impl<'a> Debug for PackageUrl<'a>
source§impl Display for PackageUrl<'_>
impl Display for PackageUrl<'_>
source§impl FromStr for PackageUrl<'static>
impl FromStr for PackageUrl<'static>
source§impl<'a> PartialEq for PackageUrl<'a>
impl<'a> PartialEq for PackageUrl<'a>
source§fn eq(&self, other: &PackageUrl<'a>) -> bool
fn eq(&self, other: &PackageUrl<'a>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl<'a> Eq for PackageUrl<'a>
impl<'a> StructuralPartialEq for PackageUrl<'a>
Auto Trait Implementations§
impl<'a> Freeze for PackageUrl<'a>
impl<'a> RefUnwindSafe for PackageUrl<'a>
impl<'a> Send for PackageUrl<'a>
impl<'a> Sync for PackageUrl<'a>
impl<'a> Unpin for PackageUrl<'a>
impl<'a> UnwindSafe for PackageUrl<'a>
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