-
Notifications
You must be signed in to change notification settings - Fork 431
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added serde1
feature to Serialize/Deserialize WeightedIndex
#974
Conversation
It required adding serde as an optional dependency. Also added a test using bincode like in the other crate.
Thanks @CGMossa. Hmm, would it be possible to do the reformatting first in its own commit? Also please add a note to the changelog. |
I have the intellij auto use rustfmt. Which is not admittedly cool, but I
thought that would be fine.
I'll add a line in the changelog.
I thought you'd suggest more things to add the derive attribute to. I'd be
happy to add it everywhere needed. But I don't know which places.
…On Fri, May 1, 2020, 19:29 Diggory Hardy ***@***.***> wrote:
Thanks @CGMossa <https://github.com/CGMossa>. Hmm, would it be possible
to do the reformatting *first* in its own commit? Also please add a note
to the changelog.
https://rust-random.github.io/book/contributing.html
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#974 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAIDVSCCVXXWLSJQCZ62MLLRPMBGPANCNFSM4MXET6CQ>
.
|
It crossed my mind that this might be a good idea, but I didn't look into where yet. Probably would only be applicable to distributions. |
This reverts commit 9c823fa.
This time without the rustfmt invocation.
These are the changes you've asked for. I will experiment with making all
the distributions serde complaint.
…On Fri, May 1, 2020, 20:31 Diggory Hardy ***@***.***> wrote:
I thought you'd suggest more things to add the derive attribute to. I'd be
happy to add it everywhere needed. But I don't know which places.
It crossed my mind that this might be a good idea, but I didn't look into
where yet. Probably would only be applicable to distributions.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#974 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAIDVSFNXMAM2WC6EOIEWR3RPMIQDANCNFSM4MXET6CQ>
.
|
It looks like the minimal supported serde version is incorrectly specified. |
I wrote it exactly like it is written in serde = "1.0.106" or serde = "1.0.*" ? |
Hopefully this will do it.
I see that tha CI stuff is resulting in an error. I am unable to see the same error here. I've added a version number to one of the |
This worked. I've no idea why, since the other crates in the rand-workspace also indicated serde with |
We test with the minimal version of Serde which crates say they support — but this must be unified across all dependencies, so will be the highest minimum version. The idea is to find the real minimum version, but I think most people only care that it's high enough to work. That said, 1.0.105 is less than two months old. If an older version suffices that would be preferable. You can test locally via |
For completeness's sake (if you don't mind), we should also consider: |
Yep, I'll take a look later today.
Thanks for the follow up!
…On Mon, 4 May 2020 at 09:40, Diggory Hardy ***@***.***> wrote:
For completeness's sake (if you don't mind), we should also consider:
Bernoulli, Uniform, UniformFloat, UniformDuration, StepRng, IndexVec
(maybe).
The following structs have zero size (thus don't need serialising), but
doing so might ease deriving of other types: OpenClosed01, Open01,
Standard, Alphanumeric.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#974 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAIDVSGSA6JM5OM46NQ4D33RPZWONANCNFSM4MXET6CQ>
.
|
Minimal supported serde version is
Test command: rustup run nightly cargo generate-lockfile -Z minimal-versions & cargo test --features=serde1,log |
#TODO: Test of equality between ser/de is needed.
#TODO: Unable to test equality in mode between de-serialized and original UniformDuration
This version is almost six months old. Since we're developing against the master branch (will be a breaking release), this is fine IMO. |
… `Open01`, and `Standard`
I've added the serialize and deserialize annotations. I also wanted to add tests using I've left some skeleton code, awaiting further feedback. (this is like my biggest attempt at contributing yet! Thanks for the PR-mentoring!!) |
Am I missing more things here? |
Sorry, I'll try to review in the next couple of days. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I haven't been paying this project much attention lately!
Your PR looks good. Those unfinished bits shouldn't be hard (I gave a couple hints).
I've added the tests based on your suggestions. Do I resolve them or do I wait for you to click that they are resolved? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. (There are some over-long lines, and you didn't need to match cases which can't occur in the tests, but it's still good enough.)
I'll wait a couple of days in case @vks wishes to review, then merge.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
This should probably be squashed before merging. I think this is technically a breaking change. |
I don't know how to squash? |
Edit: I just enabled it, you don't have to do anything, we can let GitHub do it. If you want to do that yourself, you can use |
serde1
feature to Serialize/Deseriaslize WeightedIndex
serde1
feature to Serialize/Deserialize WeightedIndex
|
I've added the missing spaces. Thanks for enabling that feature, as I've got no training in using rebase or squashing. I'd appreciate a link to learn about this. |
Thanks for the PR!
|
Implements rust-random#974. As in rust-random#975, but defining equality such that the user is not exposed to the fact that one logical state may have different representations in an implementation-specific way.
Implements rust-random#974. As in rust-random#975, but defining equality such that the user is not exposed to the fact that one logical state may have different representations in an implementation-specific way.
It required adding serde as an optional dependency.
Also added a test using bincode like in the other crate.
Referering to this: #967
I hope this is up to standard, otherwise I'll take all of your feedback and ensure it is as correct
as possible.