[PURL] parsing, manipulation, and formatting.

A PURL is an identifier that refers to a software package. For example, pkg:cargo/purl refers to this package.

This library supports PURLs at two levels:

  1. The shape and format of a PURL is implemented by [GenericPurl]. It is possible to work with package-type-agnostic PURLs by using types like GenericPurl<String>. (see also [package-url/purl-spec#38])
  2. The behavior of package types is implemented by [PackageType] and combined with [GenericPurl] by the type alias [Purl]. This implementation differs slightly from the PURL specification (see [PackageType] for details). It is possible to implement different package-type-specific behaviors or support for different package types by implementing the [PurlShape] trait.

Example

```rust use std::str::FromStr;

use purl::GenericPurl;

fn main() -> Result<(), Box> { let purl = GenericPurl::::fromstr( "pkg:NPM/@acme/example@1.2.3?Checksum=sha256:\ E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855", )?; asserteq!("npm", purl.packagetype()); asserteq!(Some("@acme"), purl.namespace()); asserteq!("example", purl.name()); asserteq!(Some("1.2.3"), purl.version()); // Normalization is performed during parsing. asserteq!( "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", purl.qualifiers()["checksum"], ); asserteq!( "pkg:npm/%40acme/example@1.2.3?checksum=sha256:\ e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", &purl.to_string(), );

let purl = purl.into_builder().without_version().without_qualifier("checksum").build()?;
assert_eq!("pkg:npm/%40acme/example", &purl.to_string(),);
Ok(())

} ```

Features