servicepoint/crates/servicepoint_binding_cs/ServicePoint/Packet.cs
2024-10-20 13:31:41 +02:00

24 lines
570 B
C#

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