Lucian Branescu a écrit : > Something like this > http://pcwalton.github.com/blog/2012/08/08/a-gentle-introduction-to-traits-in-rust/
Very nice introduction. The only question that arises for me (coming from c++ ground and comparing this to c++ templates) is why trait implementation is made explicit ? Is it a design decision or a current compiler limitation ? I guess the compiler could not too difficultly be made smart enough to determine from its actual interface if a type conforms to a trait. Code generation may be more a problem, though… Julien > On 23 October 2012 13:23, Henri Sivonen <[email protected]> wrote: >> On Tue, Oct 23, 2012 at 3:20 PM, Lucian Branescu >> <[email protected]> wrote: >>> I think it's possible to implement methods on a struct directly, >>> without a trait in between. >> >> This does not compile: >> >> struct Foo { >> x: i32, >> y: i32, >> fn bar() { >> >> }, >> } >> >> -- >> Henri Sivonen >> [email protected] >> http://hsivonen.iki.fi/ >> _______________________________________________ >> Rust-dev mailing list >> [email protected] >> https://mail.mozilla.org/listinfo/rust-dev > _______________________________________________ > Rust-dev mailing list > [email protected] > https://mail.mozilla.org/listinfo/rust-dev > _______________________________________________ Rust-dev mailing list [email protected] https://mail.mozilla.org/listinfo/rust-dev
