These are chat archives for rust-lang/rust

11th
Jul 2017
Zakarum
@omni-viral
Jul 11 2017 11:18
Can I somehow get сartesian product for iterators?
Daan Rijks
@ijks
Jul 11 2017 11:21
@omni-viral I think the itertools crate has a macro for that
dang, beat me to it :p
Zakarum
@omni-viral
Jul 11 2017 11:50
@ijks Thanks!
RuRu92
@RuRu92
Jul 11 2017 12:06

Hey people! Looking into rust and going through common programming tasks and trying to learn about threads and concurrency.

So one of the good prime problems is the dinning philosopher.
The question is regarding rust, the behavior it shows is strange, it's synchronous and dinners eat one at a time. Is this intended or the example for in rust documentation has an error?

Ilya Bogdanov
@vitvakatu
Jul 11 2017 12:12
@RuRu92 no error in docs. Only two philosophers can eat at a time. Why do you think the behavior is strange?
Denis Lisov
@tanriol
Jul 11 2017 12:13
Seems to be answered on SO. That may be one of the reasons this example has been removed from Rust docs.
RuRu92
@RuRu92
Jul 11 2017 12:29

That's what I have noticed as well, it's on 1.5 but not on the latest docs.

And in my case only one is ever eating at one time, never two. Also always the 3rd dinner that starts. It doesn't demonstrate the problem well. Feels odd when coming from java or c++

Denis Lisov
@tanriol
Jul 11 2017 12:32
Do you have thread::sleep_ms(150); between picking up the left fork and the right one? Try commenting it out...
Zakarum
@omni-viral
Jul 11 2017 13:42
Only two nonoverlapping philosophers can eat at one time. But only if they come first and second.
Otherwise only one would eat
Zakarum
@omni-viral
Jul 11 2017 16:44
How to create texture with gfx-rs so 0x7f value in channel would map to ~ 0.5 in shader?

Right now I have to do

color = pow(color, vec3(1.0/2.33));

to correct values

Lance Carlson
@lancecarlson
Jul 11 2017 22:45
is it possible to have private methods in your From trait implementations?
or is it generally frowned upon?