servicepoint/crates/servicepoint_binding_cs/ServicePoint/Packet.cs

19 lines
422 B
C#
Raw Normal View History

using System.Diagnostics.CodeAnalysis;
namespace ServicePoint;
public sealed partial class Packet
{
public static bool TryFromBytes(Span<byte> bytes, [MaybeNullWhen(false)] out Packet packet)
{
unsafe
{
fixed (byte* bytesPtr = bytes)
{
packet = TryLoad(bytesPtr, (nuint)bytes.Length);
return packet != null;
}
}
}
}