Skip to main content

compare_with_flags

Function compare_with_flags 

Source
pub fn compare_with_flags(
    v1: &str,
    v2: &str,
    v1_flags: u32,
    v2_flags: u32,
) -> Ordering
Expand description

Compare two version strings with per-version flags.

See VERSIONFLAG_P_IS_PATCH, VERSIONFLAG_ANY_IS_PATCH, VERSIONFLAG_LOWER_BOUND, VERSIONFLAG_UPPER_BOUND.

§Panics

Panics if either version string contains an interior null byte.

§Examples

use std::cmp::Ordering;
use libversion_sys::VERSIONFLAG_P_IS_PATCH;

// By default "p" means "pre", but with the flag it means "patch" (post-release)
assert_eq!(
    libversion_sys::compare_with_flags("1.0p1", "1.0post1", VERSIONFLAG_P_IS_PATCH, 0),
    Ordering::Equal,
);