feat(collections)!: switch to ref struct enumerators

Refactor all unsafe collection enumerators to use ref struct types,
removing support for boxing and standard .NET enumeration interfaces.
GetEnumerator methods now return stack-only, more efficient enumerators
with [UnscopedRef] and inlining attributes. IEnumerable<T> and
IEnumerable implementations are removed from affected types. Interfaces
now require unmanaged types. Also includes minor doc and bug fixes.

BREAKING CHANGE: Enumerators are no longer compatible with LINQ, and collections no longer implement IEnumerable/IEnumerator.
This commit is contained in:
2026-04-10 02:51:37 +09:00
parent a108f39cbe
commit dea8de60d0
12 changed files with 175 additions and 268 deletions

View File

@@ -27,7 +27,7 @@ public unsafe interface IUnsafeCollection : IDisposable
void* GetUnsafePtr();
}
public interface IUnsafeCollection<T> : IUnsafeCollection, IEnumerable<T>
public interface IUnsafeCollection<T> : IUnsafeCollection
where T : unmanaged
{
/// <summary>
@@ -47,7 +47,7 @@ public interface IUnsafeCollection<T> : IUnsafeCollection, IEnumerable<T>
void Resize(int newSize, AllocationOption option);
}
public interface IUnsafeHashCollection<T> : IEnumerable<T>, IDisposable
public interface IUnsafeHashCollection<T> : IDisposable
where T : unmanaged
{
/// <summary>