-
Notifications
You must be signed in to change notification settings - Fork 1
shared-only fields #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
(What does it mean when a Anyway, this seems like a nice-to-have to me, but awkardly, syntax-wise the most obvious (and likely overall best) way to signify this would be by the absence of a (Edit: I see you mentioned the same thing in #3.) |
I think "blocked" means #4 requires adding |
Proposal
The current RFC proposes only "mutable" fields. That is, if you have an
&mut T
, andT: Trait
, you can mutate the fields declared inTrait
. However, it'd be nice to be able to have "shared-only" fields, where the fields act shared no matter what. So even with a&mut T
, you can only get a shared borrow of those fields.Among other things, this is needed if we ever wish to support defining traits with fields that can be implemented by
&T
types. Example:Right now, though, that is blocked by #4 in any case.
Shared-only fields are also interesting because they would have looser overlap requirements (i.e., two shared-only fields could point at the same data).
Interactions:
The text was updated successfully, but these errors were encountered: