Skip to content

Conversation

nvzqz
Copy link
Contributor

@nvzqz nvzqz commented Oct 7, 2017

Preface: This is a breaking change!!

Recently I tried using Rand on a Rng trait object but I was unable to since Rand::rand requires that the Rng be Sized.

This is mostly a proof-of-concept that should be considered when going through with the next iteration of this project.

Limitations:

  • Methods like choose are implemented generically on Rng. These cannot be used within the context of a trait object.
  • Cannot use conveniences like if rng.gen() { ... } when Rng is not Sized
  • Breaks current #[derive(Rand)] implementation
    • Relies on gen and gen_range

nvzqz added 2 commits October 7, 2017 19:07
Allows for greater use of Rng as a trait object. This is especially the
case when one wants to do T::rand(rng) and 'rng' is some &mut Rng.
@dhardy
Copy link
Member

dhardy commented Oct 10, 2017

Think I already addressed this in my PR #161 (PR still needs a lot of work in general though).

@dhardy dhardy added the B-API Breakage: API label Jan 24, 2018
@dhardy
Copy link
Member

dhardy commented Feb 20, 2018

Implemented as part of #265 and #256.

@dhardy dhardy closed this Feb 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
B-API Breakage: API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants