mirror of
https://github.com/ahwootech/BRUTAL.git
synced 2026-11-25 12:38:24 +01:00
Public-PR: https://github.com/ahwootech/BRUTAL/pull/9 Public-PR: https://github.com/ahwootech/BRUTAL/pull/15 Public-PR: https://github.com/ahwootech/BRUTAL/pull/21 Fixes: ahwootech/BRUTAL#8 Fixes: ahwootech/BRUTAL#22 Co-authored-by: Laurens de Voogd <laurens@devoogd.be> Co-authored-by: sGo7-Dev <goulax16@gmail.com> Co-authored-by: Capsup <capsup@live.dk>
17 lines
780 B
C#
17 lines
780 B
C#
namespace Brutal.SlangApi;
|
|
|
|
/// <summary>
|
|
/// Hand-written ergonomic helpers on top of the generated <see cref="ISlangBlob"/>
|
|
/// COM interface. The interface itself only exposes a raw <c>void*</c> + size pair;
|
|
/// callers shouldn't have to assemble a span by hand to read the contents.
|
|
/// </summary>
|
|
public static unsafe partial class ISlangBlobExtensions
|
|
{
|
|
/// <summary>
|
|
/// Returns the blob's contents as a <see cref="ReadOnlySpan{Byte}"/>. The span is
|
|
/// valid until the blob is passed to <see cref="Slang.Release"/>. Copy if you need
|
|
/// the bytes to outlive it.
|
|
/// </summary>
|
|
public static ReadOnlySpan<byte> AsSpan(this ISlangBlob self) =>
|
|
new(self.GetBufferPointer(), checked((int)self.GetBufferSize().Value));
|
|
}
|