simple-selectors

Crates.iosimple-selectors
lib.rssimple-selectors
version0.1.0
sourcesrc
created_at2018-02-12 08:50:34.633159
updated_at2018-02-12 08:50:34.633159
descriptionA simple label selector syntax inspired (and mostly compatible) to k8s
homepagehttps://github.com/m0ppers/simple-selectors
repositoryhttps://github.com/m0ppers/simple-selectors
max_upload_size
id50800
size21,135
(m0ppers)

documentation

README

simple-selectors

Build Status License: Unlicense Crates.io

k8s style selectors for rust.

BNF

  <selector-syntax>         ::= <requirement> | <requirement> "," <selector-syntax>
  <requirement>             ::= [!] KEY [ <set-based-restriction> | <exact-match-restriction> ]
  <set-based-restriction>   ::= "" | <inclusion-exclusion> <value-set>
  <inclusion-exclusion>     ::= <inclusion> | <exclusion>
  <exclusion>               ::= "notin"
  <inclusion>               ::= "in"
  <value-set>               ::= "(" <values> ")"
  <values>                  ::= VALUE | VALUE "," <values>
  <exact-match-restriction> ::= ["="|"=="|"!="] VALUE

*) This section has been copy pasted from https://github.com/blendlabs/go-selector (this is what this library is based upon)

Usage

let mut labels = LabelMap::new();
labels.insert("test", "test");
labels.insert("test1", "test");
let result = parse("test = test, test1 in (test)", &labels);

Feedback and Contributions

Both very welcome. This is my first public crate and I am just starting to learn rust. So non-idiomatic rust and beginner mistakes are to be expected in the code base. Please provide feedback and contributions so I can fix it :).

Commit count: 20

cargo fmt