By subtyping, do you mean defining class hierarchies as in C++ or Java? This is currently not supported. Typically such hierarchies are modeled either using an `enum` (most common) or using a `trait`.
Enums are perfect for cases where there is a limited set of possibilities. Traits are perfect for "open-ended" situations where you have an interface and many ways to fulfill it. The two techniques *can* be combined for cases that fall between the two extremes. We have considered adding a limited form of struct inheritance (so that one struct can build on another) but afaik this feature is not planned in the short term. Niko On Mon, Sep 09, 2013 at 07:04:07PM +1200, Nick Cameron wrote: > Is there somewhere I can look for a description of subtyping in Rust? I > don't see any mention of it in the manual or tutorial. > > Thanks, Nick > _______________________________________________ > Rust-dev mailing list > Rust-dev@mozilla.org > https://mail.mozilla.org/listinfo/rust-dev _______________________________________________ Rust-dev mailing list Rust-dev@mozilla.org https://mail.mozilla.org/listinfo/rust-dev