On Tue, Nov 5, 2013 at 9:17 AM, Patrick Walton <[email protected]> wrote:

> On 11/5/13 2:44 AM, spir wrote:
>
>> Why not just add a declaration of the trait at the top of the struct
>> type def?
>>
>> struct PairList<Val> : Iterable {
>>
>
> You can implement traits on types that aren't structs.



Isn't another effect of this is the ability to "monkey-patch" structs to
implement extra methods or traits? E.g. you can later in implement a
to_str() method for a type, or implement certain traits, like Clone or Drop.


--
Ziad
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to