servicepoint/crates/servicepoint_binding_cs/ServicePoint/ServicePointExtensions.cs

22 lines
543 B
C#
Raw Normal View History

using System.Diagnostics.CodeAnalysis;
namespace ServicePoint;
public static class ServicePointExtensions
{
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
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);
}
}