2024-05-15 20:34:51 +02:00
|
|
|
using System.Diagnostics.CodeAnalysis;
|
|
|
|
|
2024-05-25 11:16:37 +02:00
|
|
|
namespace ServicePoint;
|
2024-05-15 20:34:51 +02:00
|
|
|
|
2024-05-25 11:16:37 +02:00
|
|
|
public static class ServicePointExtensions
|
2024-05-15 20:34:51 +02:00
|
|
|
{
|
|
|
|
public static Packet IntoPacket(this Command command)
|
|
|
|
{
|
|
|
|
return Packet.FromCommand(command);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static bool TryIntoCommand(this Packet packet, [MaybeNullWhen(false)] out Command command)
|
|
|
|
{
|
|
|
|
return Command.TryFromPacket(packet, out command);
|
|
|
|
}
|
2024-10-16 22:46:34 +02:00
|
|
|
|
2024-10-19 14:21:50 +02:00
|
|
|
public unsafe static Span<byte> AsSpan(this SPByteSlice slice)
|
2024-10-16 22:46:34 +02:00
|
|
|
{
|
|
|
|
return new Span<byte>(slice.start, (int)slice.length);
|
|
|
|
}
|
2024-05-15 20:34:51 +02:00
|
|
|
}
|