decline-cookies / anvil-unity-dots

Unity DOTS and ECS specific additions and extensions to Anvil
MIT License
4 stars 1 forks source link

FixedList... Extension Methods #206

Closed mbaker3 closed 1 year ago

mbaker3 commented 1 year ago

Add extension methods for FixedList implementations

What is the current behaviour?

FixedList only contains IndexOf and Contains implementations that take ref arguments. This is not usable when trying to call these methods in a read only context (readonly struct or [ReadOnly] attribute).

There is no way to call RemoveSwapBack when the fixed list contains elements of type enum

What is the new behaviour?

Developers can use IndexOfReadOnly and ContainsReadOnly on read-only references to their collections.

RemoveSwapBack can now be used if the elements of the list are of type enum so long as they cast their enum value down to its underlying type. Under the hood, this uses the existing Anvil FixedListInternal extension methods that allow IndexOf and Contains to be used on enum elements. (#175)

What issues does this resolve?

What PRs does this depend on?

Does this introduce a breaking change?