Updated the SegmentedPool to allow for zeroing of allocations and for returning a pointer to allocated memory to allow for use in unsafe structs (#2)

This commit was merged in pull request #2.
This commit is contained in:
Jim
2026-03-20 17:51:15 +00:00
parent dfbdf905fe
commit c2150acb2c
15 changed files with 2788 additions and 674 deletions

View File

@@ -0,0 +1,34 @@
using UnmanagedMMU.Allocators;
namespace UnmanagedMMU.Handles
{
/// <summary>
/// Interface that represents a typed handle to unmanaged memory.
/// </summary>
/// <typeparam name="T">
/// The unmanaged element type stored in the underlying memory block.
/// </typeparam>
public unsafe interface IMemoryHandle<T> : IMemoryHandle, IDisposable where T : unmanaged
{
/// <summary>
/// Gets the typed <typeparamref name="T"/> pointer to the underlying unmanaged memory block.
/// </summary>
/// <remarks>
/// The pointer becomes invalid after the handle is disposed.
/// </remarks>
new T* Pointer { get; }
/// <summary>
/// Gets the number of elements contained in this handle.
/// </summary>
nuint Length { get; }
/// <summary>
/// Returns the underlying unmanaged memory block held by this handle back to the owning <see cref="IUnmanagedMemoryOwner"/> instance
/// </summary>
new void Dispose() { }
}
}