using System.Runtime.InteropServices; namespace LLama.Native; /// /// Indicates position in a sequence /// [StructLayout(LayoutKind.Sequential)] public record struct LLamaPos { /// /// The raw value /// public int Value; /// /// Create a new LLamaPos /// /// private LLamaPos(int value) { Value = value; } /// /// Convert a LLamaPos into an integer (extract the raw value) /// /// /// public static explicit operator int(LLamaPos pos) => pos.Value; /// /// Convert an integer into a LLamaPos /// /// /// public static implicit operator LLamaPos(int value) => new(value); /// /// Increment this position /// /// /// public static LLamaPos operator ++(LLamaPos pos) { return new LLamaPos(pos.Value + 1); } /// /// Increment this position /// /// /// public static LLamaPos operator --(LLamaPos pos) { return new LLamaPos(pos.Value - 1); } }