You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This crate is an implementation of the Package URL
specification for the Rust programming language.
🔌 Usage
Add this crate to the Cargo.toml:
[dependencies]
packageurl = "0.5.0"
Parse a string containing a raw PURL using the
FromStr trait:
use std::str::FromStr;use packageurl::PackageUrl;fnexample(){let purl = PackageUrl::from_str("pkg:cargo/packageurl@0.3.0");}
Creating a PURL from Rust and then generating a string representation using:
the ToString trait:
use std::string::ToString;fnexample(){let canonical = package::PackageUrl::new("cargo","packageurl").expect("only fails if type is invalid").with_version("0.3.0").to_string();}
serde serialization and deserialization is also supported, provided the
serde feature is enabled:
[dependencies]
packageurl = { version = "0.5.0", features = ["serde"] }
Found a bug? Have an enhancement request? Head over to the
GitHub issue tracker of the project if
you need to report or ask something. If you are filling in on a bug, please include as much
information as you can about the issue, and try to recreate the same bug in a simple, easily
reproducible situation.
⚖️ License
This library is provided under the open-source MIT license.
About
Rust implementation of the Package URL specification.