sealBytes

fnimmutable(ubyte)[] sealBytes(T)(ref T[] buffer) @trusted pure nothrow

Seals a builder buffer and returns it as raw immutable bytes, the form ArrayData stores. Always seal through this helper instead of writing cast(immutable(ubyte)[]) seal(buf): GDC 16.2 miscompiles that exact expression — a reinterpret cast applied directly to the result of a function that nulls its ref parameter yields a null pointer with the converted length (fact 18) — while binding the sealed slice to a local first, as this helper does, is correct on all four compilers.

Parameters

bufferthe builder's mutable slice; nulled by this call

Returns

the same memory as an immutable(ubyte)[] slice.