using System.Diagnostics; using System.Runtime.InteropServices; namespace LLama.Native; /// /// A single token /// [StructLayout(LayoutKind.Sequential)] [DebuggerDisplay("{Value}")] public readonly record struct LLamaToken { /// /// The raw value /// private readonly int Value; /// /// Create a new LLamaToken /// /// private LLamaToken(int value) { Value = value; } /// /// Convert a LLamaToken into an integer (extract the raw value) /// /// /// public static explicit operator int(LLamaToken pos) => pos.Value; /// /// Convert an integer into a LLamaToken /// /// /// public static implicit operator LLamaToken(int value) => new(value); /// public override string ToString() { return Value.ToString(); } }