Conversation
|
Okay, looks good to me. Yes, there is logic in returning different types of errors. Oh, |
|
Didn't realize that |
|
Pushed an updated PR that should work on 1.22. |
56a339d to
bc655b5
Compare
|
Err... I have no idea what's going on. Current builds are failing locally for me due to being unable to find However fixing that in this PR causes test failures with |
|
Seems to be working now. |
| NoItem, | ||
| NegativeWeight, | ||
| AllWeightsZero, | ||
| } |
There was a problem hiding this comment.
Some (minimal) docs would be nice.
There was a problem hiding this comment.
I'm surprised there wasn't an error about this actually; we use deny(missing_docs). But it doesn't look too bad:
https://rust-lang-nursery.github.io/rand/rand/distributions/enum.WeightedError.html
There was a problem hiding this comment.
Yes, this is weird. In any case, I opened #550 to fix this.
There was a problem hiding this comment.
The reason it wasn't an error is because we have #[doc(hidden)] for a bunch of stuff in distributions/mod.rs. They are removed in #548 though.
This fixes #535. I didn't add a
impl From<WeightedError> for Error { .. }since I'm not sure how that's used, and so didn't know how to write/test an implementation. Happy to add one if anyone has pointers.It's a little irky to have
chooseandchoose_weightedindicate errors in different ways (one throughOptionand one throughResult). However negative weights are substantially different than anything thatchoosehas to deal with, so it does make sense.