Module pubgrub::version_set

source ·
Expand description

As its name suggests, the VersionSet trait describes sets of versions.

One needs to define

  • the associate type for versions,
  • two constructors for the empty set and a singleton set,
  • the complement and intersection set operations,
  • and a function to evaluate membership of versions.

Two functions are automatically derived, thanks to the mathematical properties of sets. You can overwrite those implementations, but we highly recommend that you don’t, except if you are confident in a correct implementation that brings much performance gains.

It is also extremely important that the Eq trait is correctly implemented. In particular, you can only use #[derive(Eq, PartialEq)] if Eq is strictly equivalent to the structural equality, i.e. if version sets have canonical representations. Such problems may arise if your implementations of complement() and intersection() do not return canonical representations so be careful there.

Traits§