Safety: context and disposer must satisfy the ownership, GC-root and thread restrictions of this type. Never adopt a borrowed reference as an owner.
ProviderHandle.adopt
Status!TextError adopt(Tag)(ref ProviderHandle destination, void * context,
Release release) if (is(Tag == struct)) static @system nothrow @nogcAdopts one owned native reference, tagged by a provider-defined type. The caller owns context on failure and transfers it on success. Replacing a destination releases its previous lease, unlike an out-role factory.
Parameters
Tag | provider-defined identity type shared only by compatible adapters. |
destination | receives the lease; may already hold another lease. |
context | non-null native context with all required native parents retained. |
release | non-null disposer of that owned reference, valid for its lifetime. |
Returns
success, INVALID_INPUT, or ALLOCATION_FAILED. No D GC allocation.