#url #specification #package #purl

packageurl

Rust implementation of the package url specification

3 releases (breaking)

Uses old Rust 2015

0.3.0 Jul 2, 2021
0.2.0 Jun 14, 2018
0.1.0 Apr 13, 2018

#869 in Parser implementations

Download history 1047/week @ 2023-12-13 993/week @ 2023-12-20 389/week @ 2023-12-27 760/week @ 2024-01-03 1378/week @ 2024-01-10 1142/week @ 2024-01-17 991/week @ 2024-01-24 1173/week @ 2024-01-31 1715/week @ 2024-02-07 1201/week @ 2024-02-14 1244/week @ 2024-02-21 1804/week @ 2024-02-28 1500/week @ 2024-03-06 1152/week @ 2024-03-13 1205/week @ 2024-03-20 974/week @ 2024-03-27

5,280 downloads per month
Used in 10 crates (5 directly)

MIT license

37KB
696 lines

packageurl-rs Star me

Read and generate Package URLs in Rust.

Actions Codecov Source Crate Documentation CargoMake Changelog GitHub issues

About

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.3.0"

Parse a string containing a raw PURL using the FromStr trait:

extern crate packageurl
use std::str::FromStr;
use packageurl::PackageUrl;

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:

extern crate packageurl;
use std::string::ToString;

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.3.0", features = ["serde"] }

See more in the online documentation.

📝 Features

  • memchr: use the memchr crate to locate separator when parsing.
  • serde: enable serialization and deserialization support with the serde crate.

📋 Changelog

This project adheres to Semantic Versioning and provides a changelog in the Keep a Changelog format.

💭 Feedback

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.

Dependencies

~0.3–1MB
~22K SLoC