PgNativeBox<T>
Namespace: Ankus
Assembly: Ankus.Runtime.dll
Individually owns one unmanaged value in a checked PostgreSQL allocation.
public sealed class PgNativeBox<T> : IDisposable where T : unmanagedType parameters:
T
The unmanaged representation copied to and from native storage.
Disposal frees the native allocation without invoking a constructor or destructor on its value. There is no finalizer. The unmanaged constraint does not establish a C ABI layout or SQL type. Native allocator restrictions apply: Bump storage rejects individual disposal and remains live until context cleanup. Use context-owned values when individual release is unavailable.
Inheritance: object
Implements: IDisposable
Properties
Section titled “Properties”Alignment
Section titled “Alignment”Gets the requested explicit alignment, or zero for the server default.
public nuint Alignment { get; }Value: nuint
Context
Section titled “Context”Gets the allocation’s actual native owner while the allocation remains live.
public PgMemoryContext Context { get; }Value: PgMemoryContext
Options
Section titled “Options”Gets the original initialization and native size policies.
public PgAllocationOptions Options { get; }Value: PgAllocationOptions
Gets or sets a copied unmanaged value after validating the allocation’s native lifetime.
public T Value { get; set; }Value: T
Methods
Section titled “Methods”Borrow()
Section titled “Borrow()”Borrows a checked typed view without transferring ownership.
public PgNativeReference<T> Borrow()Returns: PgNativeReference<T>
The view sharing this allocation’s checked lifetime.
CloneInto(PgMemoryContext?)
Section titled “CloneInto(PgMemoryContext?)”Copies all representation bytes into independent context-owned storage.
public PgContextValue<T> CloneInto(PgMemoryContext? context = null)Parameters:
context — PgMemoryContext
The destination context, or null for the current context.
Returns: PgContextValue<T>
A shallow context-owned copy with default allocation policies.
CloneOwnedInto(PgMemoryContext?)
Section titled “CloneOwnedInto(PgMemoryContext?)”Copies all representation bytes into independent individually owned storage.
public PgNativeBox<T> CloneOwnedInto(PgMemoryContext? context = null)Parameters:
context — PgMemoryContext
The destination context, or null for the current context.
Returns: PgNativeBox<T>
A shallow individually owned copy with default allocation policies.
Dispose()
Section titled “Dispose()”Releases the native storage once; a failed native free retains release rights for retry.
public void Dispose()ReleaseToContext()
Section titled “ReleaseToContext()”Transfers individual release rights to the native context while retaining checked storage and existing views.
public PgContextValue<T> ReleaseToContext()Returns: PgContextValue<T>
The context-owned value; this owning wrapper becomes consumed.