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

rand::Rng should be implemented for &Rng #8575

Closed
nsf opened this issue Aug 17, 2013 · 4 comments
Closed

rand::Rng should be implemented for &Rng #8575

nsf opened this issue Aug 17, 2013 · 4 comments

Comments

@nsf
Copy link
Contributor

nsf commented Aug 17, 2013

Well, I've read that rust doesn't encourage using traits as interfaces. But to me it sounds like a must. On IRC @cmr also suggested me to open an issue. Here it is.

It seems reasonable to have an implementation of Rng for &Rng. Or be it &mut Rng or whatever is necessary to make it work when you use traits as an interface.

@pzol
Copy link
Contributor

pzol commented Feb 26, 2014

Visiting for triage.
@nsf can you provide an example?

@nsf
Copy link
Contributor Author

nsf commented Feb 26, 2014

Well, I was experimenting with https://github.com/mozilla/rust/blob/master/src/test/bench/noise.rs at the time and thought about replacing the template function it has: https://github.com/mozilla/rust/blob/master/src/test/bench/noise.rs#L26-L29 with a one based on "interfaces".

Besides that, I don't write rust at the moment, so I have no other examples.

@reem
Copy link
Contributor

reem commented Sep 15, 2014

Triage:

I think this falls under the general complaint that Box<X> does not always implement X. This should be fixed under DST IIRC, so recommending a close.

@steveklabnik
Copy link
Member

Yes, object safety and such means that this should work now.

flip1995 pushed a commit to flip1995/rust that referenced this issue May 5, 2022
add `trim_split_whitespace`

Closes rust-lang#8521

changelog: [`trim_split_whitespace`]
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

No branches or pull requests

4 participants