simple-selectors 0.1.0

A simple label selector syntax inspired (and mostly compatible) to k8s
Documentation
  • Coverage
  • 90%
    9 out of 10 items documented0 out of 0 items with examples
  • Size
  • Source code size: 21.43 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 2.24 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 12s Average build duration of successful builds.
  • all releases: 12s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • m0ppers/simple-selectors
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • m0ppers

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 :).