Skip to content

csaf-rs/vers-like-specifier

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vls

A Rust library for parsing and validating Vers-like Specifiers (vls) as defined in CSAF 2.0 and CSAF 2.1.

vls is the <constraints> portion of a vers URL without the vers:<type>/ prefix.

It represents a |-separated list of constraints each consisting of an implicit or explicit comparator and a version string.

Due to the undefined / unknown schema, it is nearly impossible for tools to reliably determine whether a given version is in the range or not. vls is a fallback option and SHOULD NOT be used unless really necessary.

Minimum Supported Rust Version (MSRV)

1.88.0

Installation

Add vls to your Cargo.toml:

[dependencies]
vls = "0.1"

Note: This crate has not yet been published to crates.io. In the meantime, use a git dependency:

[dependencies]
vls = { git = "https://github.com/csaf-rs/vls" }

Usage

use vls::{Vls, Comparator};

let vls: Vls = ">=1.0.0|<2.0.0".parse().unwrap();
assert_eq!(vls.constraints().len(), 2);
assert_eq!(vls.to_string(), ">=1.0.0|<2.0.0");


let constraints = vls.constraints();
assert_eq!(constraints[0].comparator(), &Comparator::GreaterThanOrEqual);
assert_eq!(constraints[0].version().to_string(), "1.0.0");
assert_eq!(constraints[1].comparator(), &Comparator::LessThan);
assert_eq!(constraints[1].version().to_string(), "2.0.0");

License

Licensed under the Apache License, Version 2.0.

About

Implementation of vls from CSAF

Resources

License

Stars

0 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages