#version-string #debian #parser #comparison #validation #policy #sqlx

debversion

Debian version parsing, manipulation and comparison

14 releases

0.3.0 Mar 9, 2024
0.2.2 Sep 27, 2023
0.2.0 Jul 17, 2023
0.1.9 Jul 17, 2023

#1013 in Encoding

Download history 807/week @ 2023-12-21 639/week @ 2023-12-28 324/week @ 2024-01-04 188/week @ 2024-01-11 387/week @ 2024-01-18 652/week @ 2024-01-25 420/week @ 2024-02-01 762/week @ 2024-02-08 766/week @ 2024-02-15 613/week @ 2024-02-22 576/week @ 2024-02-29 2003/week @ 2024-03-07 864/week @ 2024-03-14 1521/week @ 2024-03-21 1545/week @ 2024-03-28 3446/week @ 2024-04-04

7,465 downloads per month
Used in 13 crates (10 directly)

Apache-2.0

25KB
578 lines

debian version handling in rust

This simple crate provides a struct for parsing, validating, manipulating and comparing Debian version strings.

It aims to follow the version specification as described in Debian policy 5.6.12.

Example:

use debversion::Version;

let version: Version = "1.0-1".parse()?;
assert_eq!(version.epoch, Some(0));
assert_eq!(version.upstream_version, "1.0");
assert_eq!(version.debian_revision, Some("1"));

let version1: Version = "1.0-0".parse()?;
let version2: Version = "1.0".parse()?;
assert_eq!(version1, version2);

let version1: Version = "1.0-1".parse()?;
let version2: Version = "1.0~alpha1-1".parse()?;
assert!(version2 < version1);

Features

sqlx

The sqlx feature adds serialization support for the postgres debversion extension when using sqlx.

python-debian

The python-debian feature provides conversion support between the debversion Rust type and the Version class provided by python-debian, when using pyop3.

serde

The serde feature enables serialization to and from simple strings when using serde.

Dependencies

~2–17MB
~213K SLoC