Skip to content
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

Documentation added how to generate a struct #242

Closed
wants to merge 1 commit into from
Closed

Documentation added how to generate a struct #242

wants to merge 1 commit into from

Conversation

fspillner
Copy link

This is a PR addressing the missing documentation how to generate a struct, aiming for improving the "first-time" user experience with the library.

For that simple use case I needed to dig into the code of QuickCheck to find out, how to generate a arbitrary struct. And I had troubles with the missing Rnd instance for the given type, so I've added a notice about this. Maybe it's worth to have own topic for this issue.

What do you think?

Comment on lines +386 to +389
Point {
x: g.gen(),
y: g.gen(),
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be

Point {
    x: i32::arbitrary(g),
    y: i32::arbitrary(g),
}

They way you did it depends on the rand api, which is prone to changing, see #241. Making my suggested change also obsoletes the accompanying notice (and the dependency hell that I think would come with it)

BurntSushi pushed a commit that referenced this pull request Jan 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants