[rust-dev] Questions from a newcomer

Abraham Egnor abe.egnor at gmail.com
Sun Jan 12 05:09:13 PST 2014

Hello!  The 0.9 release prompted me to poke at my nascent rust code.  Very
impressed with the language and the progress since I last looked (0.4

Some questions that I wasn't able to find answers for:

* Is there any built-in way to iterate over all values of a C-like enum?
 It's not hard to define an iterator method that implements this for any
given type, but it's tedious boilerplate that seems better left to the

* Is it possible to express "if a type implements trait A, here is a
default implementation of trait B"?  I tried the obvious way ("impl<T:
TraitA> TraitB for T"), but it looks like the rust compiler can't
disambiguate between that impl and type-specific impls.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/rust-dev/attachments/20140112/40dfadd6/attachment.html>

More information about the Rust-dev mailing list