Skip to content
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

Add AsValueEnumerable for Unity.Collections types #71

Merged
merged 1 commit into from
Mar 26, 2025

Conversation

nuskey8
Copy link
Contributor

@nuskey8 nuskey8 commented Mar 25, 2025

This PR implements UnityCollectionsExtensions, which is currently unimplemented. I added AsValueEnumerable() to Unity.Collections types, including all native containers and FixedList/FixedString.

@nuskey8
Copy link
Contributor Author

nuskey8 commented Mar 25, 2025

Points to consider in implementation are as follows.

  • Methods for Unsafe containers have not been implemented. Most users will not use these containers directly, so support for these types is not necessary.
  • In principle, it is possible to obtain a ReadOnlySpan<T> from FixedList or FixedString, but the necessary information is hidden internally, so we will need to use Unsafe.As() to extract the contents. Implementing these is complex, so I have not implemented them as I have determined that the benefits are not worth it.

@neuecc
Copy link
Member

neuecc commented Mar 26, 2025

Thank you!
I was planning to just use NativeArray/List, so I'm grateful that you've covered it so comprehensively!

@neuecc neuecc merged commit 8dd6972 into Cysharp:main Mar 26, 2025
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants