nikomatsakis / fields-in-traits-rfc

An (experimental) RFC repo devoted to the "fields in traits" RFC.
Apache License 2.0
65 stars 1 forks source link

`?Sized` fields #11

Open nikomatsakis opened 7 years ago

nikomatsakis commented 7 years ago

@glaebhoerl points out that it might make sense to allow fields of "DST" type. They give some examples:

E.g. given a trait HasBytes with an associated field bytes: [u8], I could imagine impls of it for particular structs mapping it onto any of: (a) a fixed-size array my_field: [u8; 666], (b) a single my_field: u8, (c) an empty array [], for example if the struct doesn't even contain any u8s, (d) a dynamically-sized array my_field: [u8].

and indeed, this all makes sense. But it might be something to defer for a follow-up RFC or for the implementation.