libversion-sys
Rust FFI bindings to libversion, an advanced version string comparison library.
By default the crate vendors the C source and builds it directly, so no system-level installation of libversion is required. If you prefer linking an installed system copy, disable default features and make sure pkg-config can find libversion.
Usage
Add to Cargo.toml:
[]
= "0.2"
Use the default vendored build:
[]
= "0.2"
Or link a system-installed libversion:
[]
= { = "0.2", = false }
Safe API
use Ordering;
use ;
assert_eq!;
assert_eq!;
assert_eq!;
// "p" as patch (post-release) instead of pre-release
assert_eq!;
Raw FFI
use CString;
use ffi;
let v1 = new.unwrap;
let v2 = new.unwrap;
let result = unsafe ;
assert_eq!;
Version metadata
assert!;
assert!;
Flags
| Flag | Description |
|---|---|
VERSIONFLAG_P_IS_PATCH |
Treat p as patch (post-release) instead of pre-release |
VERSIONFLAG_ANY_IS_PATCH |
Treat any letter sequence as post-release |
VERSIONFLAG_LOWER_BOUND |
Derive lowest possible version with the given prefix |
VERSIONFLAG_UPPER_BOUND |
Derive highest possible version with the given prefix |
Build requirements
- Rust (stable)
- C compiler (gcc/clang) for the default vendored build
- libclang (for bindgen)
pkg-configand a systemlibversioninstallation when building withdefault-features = false
On Ubuntu/Debian:
For system linking:
cmake is only needed by maintainers when regenerating generated/libversion/config.h and generated/libversion/export.h after updating the vendored libversion source.
License
MIT -- see LICENSE.
The bundled libversion is also MIT licensed.