rust-lang-nursery / rust-cookbook

https://rust-lang-nursery.github.io/rust-cookbook
Creative Commons Zero v1.0 Universal
2.23k stars 285 forks source link

Cookbook ideas for threadpool crate #225

Open ericho opened 7 years ago

ericho commented 7 years ago

Issue to gather ideas for the threadpool crate

edit:

KodrAus commented 7 years ago

Dispatching some blocking io to a threadpool and returning a Result on a channel?

budziq commented 6 years ago
yandexx commented 6 years ago
ericho commented 6 years ago

Just extending @yandexx suggestion, an example could be calculate the checksum of all files in a folder tree using walkdir.

iamdanfox commented 6 years ago

Trying to think of non-file system traversing examples here... what about overlaying some text onto an animated gif? Each frame in the gif format could be processed completely independent and the piston.rs/image/gif crate can already encode/decode nicely.

budziq commented 6 years ago

@iamdanfox I'm not sure if this idea is significantly different form the fractal drawing example (which is a little artificial in itself). Could you point how this example would be different (except for per frame vs per pixel parallelism) or maybe you have some other cool ideas?

AndyGauge commented 6 years ago

I'd like to expand the examples in threadpool to do something Io bound that would be beneficial to a wider audience.

AndyGauge commented 5 years ago

Maybe we could check for clients listening on port 80. Say a request to github.io in each thread to verify the port is responding. I'm thinking using essentially this: https://doc.rust-lang.org/std/net/struct.TcpStream.html#examples to check each of these addresses: 185.199.X.153 where X is 108,109,110,111.

budziq commented 5 years ago

Maybe we could check for clients listening on port 80.

This seams a little artificial. I think that original approach of "we have a list of crates and what can we do with these" might be suboptimal in some cases (especially relatively low level crates such as this one). How about we post issues asking for contributors ideas for given domain instead of given crate?

KodrAus commented 5 years ago

@budziq Focusing on domains rather than specific libraries sounds like a good approach to me and probably more in line with the new organization too.