servicepoint/crates/servicepoint_binding_cs/ServicePoint/Packet.cs

24 lines
562 B
C#
Raw Normal View History

using System.Diagnostics.CodeAnalysis;
namespace ServicePoint;
public sealed partial class Packet
{
2024-10-19 16:04:01 +02:00
public static bool TryLoad(Span<byte> bytes, [MaybeNullWhen(false)] out Packet packet)
{
unsafe
{
fixed (byte* bytesPtr = bytes)
{
packet = TryLoad(bytesPtr, (nuint)bytes.Length);
return packet != null;
}
}
}
2024-10-19 14:45:21 +02:00
public bool TryIntoCommand([MaybeNullWhen(false)] out Command command)
{
return Command.TryFromPacket(this, out command);
}
}