Make Range fields public so others can impl SampleRange#114
Make Range fields public so others can impl SampleRange#114walruscow wants to merge 1 commit intorust-random:masterfrom
Conversation
This allows external types to implement SampleRange and use Range. Currently it is impossible to implement construct_range because the fields are private and a Range struct cannot be created.
|
I think we should avoid leaking the internals of Range, especially implementation details like |
|
From the look of it, #115 really just renames I agree that my approach here seems wrong (mostly due to the presence of I wanted to reuse this crate's random range interface for another integer type I have created, just like I can use the Is this inconsistency an oversight or a technical limitation of the language? |
|
Was also wondering what's the intended way of implementing |
This allows external types to implement SampleRange and use Range. Currently it is impossible to implement construct_range because the fields are private and a Range struct cannot be created.
Alternative approaches would be to create another new() function on Range, or to not export SampleRange & co.