On 10/23/2012 02:20 PM, Lucian Branescu wrote:
> I think it's possible to implement methods on a struct directly,
> without a trait in between.
Indeed, like this:
struct Storage {
...
}
impl Storage {
fn listen() {
...
}
}
- Tim
> On 23 October 2012 13:17, Henri Sivonen <[email protected]> wrote:
>> Now that classes are gone, what’s the right way to group a bunch of
>> fields and methods when polymorphism is not needed?
>>
>> That is, if I have a struct with some fields, some constants that make
>> sense in the context of that struct and some methods that operate on
>> the struct, how should I group them when there is no need for
>> inheritance?
>>
>> Basically, is there a guide for migrating away from classes?
>>
>> --
>> 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
>
--
Tim Taubert
Firefox Engineer
[email protected]
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev