File: README.md

package info (click to toggle)
rust-debversion 0.5.1-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 252 kB
  • sloc: makefile: 2
file content (44 lines) | stat: -rw-r--r-- 1,256 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# 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 and consistent with the behaviour of ``dpkg``.

Example:

```rust
use debversion::Version;

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

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

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

## Features

### sqlx

The `sqlx` feature adds serialization support for the postgres
[debversion extension](https://pgxn.org/dist/debversion/) 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
[pyo3](https://github.com/pyo3/pyo3).

### serde

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