Add readonly reference support for the ToFixedString extensions
What is the current behaviour?
A collection must be passed with a ref which means that any readonly references cannot make use of these extension methods.
What is the new behaviour?
Collections are now pass in with the readonly reference in so that readonly referenced collections can now leverage the extension methods.
References that were passed into the calling method with in
readonly fields
To accomplish this we're using Unity's dangerous UnsafeUtilityExtensions.AsRef to transform a readonly reference into a read/write reference. This is fine because none of our operations cause a mutation to the instance. We just create an enumerator and enumerate. This wouldn't be required if Unity marked their GetEnumerator() methods with readonly
Add readonly reference support for the ToFixedString extensions
What is the current behaviour?
A collection must be passed with a
ref
which means that any readonly references cannot make use of these extension methods.What is the new behaviour?
Collections are now pass in with the readonly reference
in
so that readonly referenced collections can now leverage the extension methods.in
readonly
fieldsTo accomplish this we're using Unity's dangerous
UnsafeUtilityExtensions.AsRef
to transform a readonly reference into a read/write reference. This is fine because none of our operations cause a mutation to the instance. We just create an enumerator and enumerate. This wouldn't be required if Unity marked theirGetEnumerator()
methods withreadonly
What issues does this resolve?
What PRs does this depend on?
Does this introduce a breaking change?