-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
[Merged by Bors] - create mutable versions of TypeRegistry
methods
#4484
Conversation
# Objective It is possible to get a mutable reference to a `TypeRegistration` using `TypeRegistry::get_mut`. However, none of its other methods (`get_mut_with_name`, `get_type_data`, `iter`, etc.) have mutable versions. Besides improving consistency, this change would facilitate use cases which involve storing mutable state data in the `TypeRegistry`. ## Solution Provides a trivial wrapper around the mutable accessors that the `TypeRegistration` already provides. Exactly mirrors the existing immutable versions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Side Note: I wish there was a better name than get_with_short_name
and get_with_short_name_mut
, but it is what it is I suppose 😅
If a type changes isn't it just a different type that should get a different |
the type isn't changing; the data registered via the type is changing. at the moment, this functionality is mainly used to store method tables keyed by type. mutability in this context can loosely be thought of as "class variables" in an OOP paradigm. |
Note that if #4567 is merged, then the added |
bors try |
tryBuild failed: |
bors r+ |
# Objective It is possible to get a mutable reference to a `TypeRegistration` using `TypeRegistry::get_mut`. However, none of its other methods (`get_mut_with_name`, `get_type_data`, `iter`, etc.) have mutable versions. Besides improving consistency, this change would facilitate use cases which involve storing mutable state data in the `TypeRegistry`. ## Solution Provides a trivial wrapper around the mutable accessors that the `TypeRegistration` already provides. Exactly mirrors the existing immutable versions.
TypeRegistry
methodsTypeRegistry
methods
# Objective It is possible to get a mutable reference to a `TypeRegistration` using `TypeRegistry::get_mut`. However, none of its other methods (`get_mut_with_name`, `get_type_data`, `iter`, etc.) have mutable versions. Besides improving consistency, this change would facilitate use cases which involve storing mutable state data in the `TypeRegistry`. ## Solution Provides a trivial wrapper around the mutable accessors that the `TypeRegistration` already provides. Exactly mirrors the existing immutable versions.
# Objective It is possible to get a mutable reference to a `TypeRegistration` using `TypeRegistry::get_mut`. However, none of its other methods (`get_mut_with_name`, `get_type_data`, `iter`, etc.) have mutable versions. Besides improving consistency, this change would facilitate use cases which involve storing mutable state data in the `TypeRegistry`. ## Solution Provides a trivial wrapper around the mutable accessors that the `TypeRegistration` already provides. Exactly mirrors the existing immutable versions.
# Objective It is possible to get a mutable reference to a `TypeRegistration` using `TypeRegistry::get_mut`. However, none of its other methods (`get_mut_with_name`, `get_type_data`, `iter`, etc.) have mutable versions. Besides improving consistency, this change would facilitate use cases which involve storing mutable state data in the `TypeRegistry`. ## Solution Provides a trivial wrapper around the mutable accessors that the `TypeRegistration` already provides. Exactly mirrors the existing immutable versions.
Objective
It is possible to get a mutable reference to a
TypeRegistration
usingTypeRegistry::get_mut
. However, none of its other methods(
get_mut_with_name
,get_type_data
,iter
, etc.) have mutableversions.
Besides improving consistency, this change would facilitate use cases
which involve storing mutable state data in the
TypeRegistry
.Solution
Provides a trivial wrapper around the mutable accessors that the
TypeRegistration
already provides. Exactly mirrors the existingimmutable versions.