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:
- The shape and format of a PURL is implemented by
GenericPurl. It is possible to work with package-type-agnostic PURLs by using types likeGenericPurl<String>. (see also package-url/purl-spec#38) - The behavior of package types is implemented by
PackageTypeand combined withGenericPurlby the type aliasPurl. This implementation differs slightly from the PURL specification (seePackageTypefor details). It is possible to implement different package-type-specific behaviors or support for different package types by implementing thePurlShapetrait.
Example
use FromStr;
use GenericPurl;
Features
- package-type:
PackageTypeand related types - serde: PURLs can be serialized and deserialized from strings
- smartstring: The smartstring crate is used to reduce heap allocations