Hi all, I have a question which I'm sure must have already been discussed
and dealt with, but I wanted to understand the design rationale:

A lot of trait-level functionality would be enhanced if a trait could
specify members to be included in the struct which implements the trait.
This can be solved in practice by wrapping member access in accessor
methods, but I fail to see why that would be preferable.

The reason I'm asking is because I'm trying to design data structures which
contain a couple of arrays, and I wanted to define the trait by not only a
set of supported operations but by the existence of both arrays so that a
default method could deal with any struct which implements the trait,
instead of having to define for every struct an accessor method for each
structure and then have to call the accessors in the trait to do anything.

Thanks

-- 
Andrés Osinski
http://www.andresosinski.com.ar/
_______________________________________________
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to