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

Standard should be implemented for NonZero types #727

Closed
joshlf opened this Issue Feb 12, 2019 · 2 comments

Comments

Projects
None yet
2 participants
@joshlf
Copy link

joshlf commented Feb 12, 2019

Now that the standard library NonZeroXXX types have been stabilized, Standard should support them.

@TheIronBorn

This comment has been minimized.

Copy link
Member

TheIronBorn commented Feb 12, 2019

In the meantime, this should work:

let distr = Uniform::new_inclusive(1, u32::max_value()); 
let sample = rng.sample(distr); 
NonZeroU32::new(sample)
// or
NonZeroI32::new(sample as i32)
@joshlf

This comment has been minimized.

Copy link
Author

joshlf commented Feb 12, 2019

@TheIronBorn Cool, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.