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 canonicalized 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) -> Result<&mut Self>
pub fn with_namespace<N>(&mut self, namespace: N) -> Result<&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) -> Result<&mut Self>
pub fn with_version<V>(&mut self, version: V) -> Result<&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 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<'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>
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