3 ms·
Do you have the source released somewhere? I'm interested in Rust but haven't really written anything large - I would find it interesting to see what a large p
by someone13 12y ago
Do you have the source released somewhere? I'm interested in Rust but haven't really written anything large - I would find it interesting to see what a large project looks like, especially the kinds of problems that come up (like you mentioned).
- mackwic 12y agoOf course, it's here: https://github.com/yaon/lottery https://github.com/yaon/lottery But even if you are familiar with the patterns we used and can guess the architecture, there will be a lot of unexplained code. I don't think you'll be able to extract a lot of knowledge of it. Anyway, you should look for io_thread.rs (I think it's the most interesting file). Look how the scope are defined (especially the use and abuse of "{}"), the alternation of &self and &mut self and random methods put out of the implementation cause rustc would accept anything when they where inside. You can also look at the mixed use of String and str which introduce a lot of chaos. And, last but not least, bonus points if you succeed to understand the why and the how of the explicits lifetimes we had to put.
- pcwalton 12y agoNote that the newest version of master Rust does not require you to write the explicit lifetime in io_thread.rs (I didn't see any others).
- ww520 12y agoHere are two Rust projects I did back at the 0.8 time frame. I tried to make it more read-friendly than clever hacks. Some of the syntax might be outdated since Rust has changed quickly and I didn't want to keep updating it until 1.0 is frozen. A memcached client lib implementing both the binary protocol and text protocol, plus sharding to multiple servers. This is simpler in scope. https://github.com/williamw520/rustymem https://github.com/williamw520/rustymem A gzip implementation and deflate implementation. This is more complicate in scope. https://github.com/williamw520/rustyzip https://github.com/williamw520/rustyzip
- pcwalton 12y ago> A memcached client lib implementing both the binary protocol and text protocol, plus sharding to multiple servers. This is simpler in scope. https://github.com/williamw520/rustymem https://github.com/williamw520/rustymem Oh, nice, I hadn't seen this before. That looks really elegant and idiomatic :)
- ww520 12y agoThanks. :) It's my first Rust project to learn it.