jonhoo / rust-zipf

Rust implementation of a fast, bounded, Zipf-distributed random number generator

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Version 3.1.0 breaks API

danieldk opened this issue · comments

Following semver, all 3.x.y versions should be API compatible. However, one of our libraries stopped building, because rust-zipf 3.1.0 changes the API:

error[E0599]: no method named `sample` found for type `zipf::ZipfDistribution` in the current scope
   --> finalfrontier/src/sampling.rs:126:27
    |
126 |         let r = self.dist.sample(&mut self.rng);
    |                           ^^^^^^
    |
    = help: items from traits can only be used if the trait is in scope
    = note: the following trait is implemented but not in scope, perhaps add a `use` for it:
            `use rand::distributions::Distribution;`

Unfortunately, rand 0.4 does not provide the Distribution trait. Would it be possible to release a version, say 3.1.1 that fixes the API breakage (and effectively reverts to rand 0.4) and have the rand 0.5 changes in a new version (4.0.0)?

(We cannot currently use rand 0.5, since we use some other crates that are still 0.4-only.)

Ps. thanks for this very useful crate!

Ah, I was hoping this wouldn't be an issue, since rand 0.4 still has the Sample trait (which we still implement). But apparently not. I've yanked 3.1.0 and released it as 4.0.0 instead :)