valence-rs/valence

Add `Deref` and `DerefMut` to all components (where appropriate)

rj00a opened this issue · 1 comments

rj00a commented

Describe the problem related to your feature request.

Accessing the data inside components is a pain. Writing .0 or .get() everywhere is cumbersome and it's easy to forget.

What solution would you like?

Derive Deref and DerefMut on all non-ZSTs implementing Component by using the derive_more crate. This should be done in a way that does not violate the privacy of the inner data, so for example a component that only provides read-only access to the inner data should not derive DerefMut.

dyc3 commented

We have a lot of components. I'd be interested to know how much this would hurt compile times.