Annotate enumerators and extension helpers for versioned variants
This commit is contained in:
1 parent
1e64c71af3
commit
3d37c1391f
8 files changed
+25
No files matched your search
@@ -7,6 +7,8 @@ namespace Recyclable.Collections
|
|||||||
public partial class RecyclableList<T>
|
public partial class RecyclableList<T>
|
||||||
{
|
{
|
||||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||||
|
[VersionedCollectionsGenerator.CloneForVersioned]
|
||||||
|
// TODO: confirm if enumerator should implement a versioned interface for generated types
|
||||||
public struct Enumerator : IEnumerator<T>
|
public struct Enumerator : IEnumerator<T>
|
||||||
{
|
{
|
||||||
private static readonly bool _isReferenceType = !typeof(T).IsValueType;
|
private static readonly bool _isReferenceType = !typeof(T).IsValueType;
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using System.Runtime.CompilerServices;
|
|||||||
|
|
||||||
namespace Recyclable.Collections
|
namespace Recyclable.Collections
|
||||||
{
|
{
|
||||||
|
[VersionedCollectionsGenerator.GenerateVersioned]
|
||||||
public static class RecyclableListExtensions
|
public static class RecyclableListExtensions
|
||||||
{
|
{
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
|||||||
@@ -6,9 +6,12 @@ namespace Recyclable.Collections
|
|||||||
{
|
{
|
||||||
public partial class RecyclableList<T> : IRecyclableVersionedList<T>
|
public partial class RecyclableList<T> : IRecyclableVersionedList<T>
|
||||||
{
|
{
|
||||||
|
[VersionedCollectionsGenerator.CloneForVersioned]
|
||||||
VersionedEnumerator IRecyclableVersionedList<T>.GetEnumerator() => new(this);
|
VersionedEnumerator IRecyclableVersionedList<T>.GetEnumerator() => new(this);
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||||
|
[VersionedCollectionsGenerator.CloneForVersioned]
|
||||||
|
// TODO: confirm if enumerator should implement a versioned interface for generated types
|
||||||
public struct VersionedEnumerator : IEnumerator<T>
|
public struct VersionedEnumerator : IEnumerator<T>
|
||||||
{
|
{
|
||||||
private int _currentItemIndex;
|
private int _currentItemIndex;
|
||||||
|
|||||||
@@ -364,12 +364,18 @@ namespace Recyclable.Collections
|
|||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
[VersionedCollectionsGenerator.CloneForVersioned]
|
||||||
|
// TODO: review if returned enumerator type should change for versioned list
|
||||||
public Enumerator GetEnumerator() => new(this);
|
public Enumerator GetEnumerator() => new(this);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
[VersionedCollectionsGenerator.CloneForVersioned]
|
||||||
|
// TODO: review if returned enumerator type should change for versioned list
|
||||||
IEnumerator IEnumerable.GetEnumerator() => new Enumerator(this);
|
IEnumerator IEnumerable.GetEnumerator() => new Enumerator(this);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
[VersionedCollectionsGenerator.CloneForVersioned]
|
||||||
|
// TODO: review if returned enumerator type should change for versioned list
|
||||||
IEnumerator<T> IEnumerable<T>.GetEnumerator() => new Enumerator(this);
|
IEnumerator<T> IEnumerable<T>.GetEnumerator() => new Enumerator(this);
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ namespace Recyclable.Collections
|
|||||||
{
|
{
|
||||||
public partial class RecyclableLongList<T>
|
public partial class RecyclableLongList<T>
|
||||||
{
|
{
|
||||||
|
[VersionedCollectionsGenerator.CloneForVersioned]
|
||||||
|
// TODO: confirm if enumerator should implement a versioned interface for generated types
|
||||||
public struct Enumerator : IEnumerator<T>
|
public struct Enumerator : IEnumerator<T>
|
||||||
{
|
{
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using System.Runtime.CompilerServices;
|
|||||||
|
|
||||||
namespace Recyclable.Collections
|
namespace Recyclable.Collections
|
||||||
{
|
{
|
||||||
|
[VersionedCollectionsGenerator.GenerateVersioned]
|
||||||
public static class RecyclableLongListExtensions
|
public static class RecyclableLongListExtensions
|
||||||
{
|
{
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
|||||||
@@ -5,9 +5,13 @@ namespace Recyclable.Collections
|
|||||||
{
|
{
|
||||||
public partial class RecyclableLongList<T> : IRecyclableVersionedLongList<T>
|
public partial class RecyclableLongList<T> : IRecyclableVersionedLongList<T>
|
||||||
{
|
{
|
||||||
|
[VersionedCollectionsGenerator.CloneForVersioned]
|
||||||
public VersionedEnumerator GetVersionedEnumerator() => new(this);
|
public VersionedEnumerator GetVersionedEnumerator() => new(this);
|
||||||
|
[VersionedCollectionsGenerator.CloneForVersioned]
|
||||||
VersionedEnumerator IRecyclableVersionedLongList<T>.GetEnumerator() => new(this);
|
VersionedEnumerator IRecyclableVersionedLongList<T>.GetEnumerator() => new(this);
|
||||||
|
|
||||||
|
[VersionedCollectionsGenerator.CloneForVersioned]
|
||||||
|
// TODO: confirm if enumerator should implement a versioned interface for generated types
|
||||||
public struct VersionedEnumerator : IEnumerator<T>
|
public struct VersionedEnumerator : IEnumerator<T>
|
||||||
{
|
{
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|||||||
@@ -372,8 +372,14 @@ namespace Recyclable.Collections
|
|||||||
|
|
||||||
public void CopyTo(T[] array, int arrayIndex) => Helpers.CopyTo(_memoryBlocks, 0, _blockSize, _longCount, array, arrayIndex);
|
public void CopyTo(T[] array, int arrayIndex) => Helpers.CopyTo(_memoryBlocks, 0, _blockSize, _longCount, array, arrayIndex);
|
||||||
|
|
||||||
|
[VersionedCollectionsGenerator.CloneForVersioned]
|
||||||
|
// TODO: review if returned enumerator type should change for versioned list
|
||||||
public Enumerator GetEnumerator() => new(this);
|
public Enumerator GetEnumerator() => new(this);
|
||||||
|
[VersionedCollectionsGenerator.CloneForVersioned]
|
||||||
|
// TODO: review if returned enumerator type should change for versioned list
|
||||||
IEnumerator IEnumerable.GetEnumerator() => new Enumerator(this);
|
IEnumerator IEnumerable.GetEnumerator() => new Enumerator(this);
|
||||||
|
[VersionedCollectionsGenerator.CloneForVersioned]
|
||||||
|
// TODO: review if returned enumerator type should change for versioned list
|
||||||
IEnumerator<T> IEnumerable<T>.GetEnumerator() => new Enumerator(this);
|
IEnumerator<T> IEnumerable<T>.GetEnumerator() => new Enumerator(this);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
|
||||||
|
|||||||
Reference in new issue
Block a user