Unit.cs (3114B)
1 using Std.Clone; 2 using Std.Cmp; 3 using Std.Convert; 4 using Std.Hashing; 5 using Std.Iter; 6 using Std.Maybe; 7 using Std.Result; 8 using static Std.Result.Result<string, Std.Bottom>; 9 using static Std.Result.Result<Std.Unit, Std.Bottom>; 10 using System.Runtime.CompilerServices; 11 using System.Runtime.InteropServices; 12 #region Namespaces 13 namespace Std { 14 #region Types 15 [StructLayout(LayoutKind.Explicit, CharSet = CharSet.Unicode, Pack = 1, Size = 1)] 16 public readonly struct Unit: IClone<Unit>, IEquality<Unit>, IExtend<Unit>, IHashable, IInto<Unit>, IInto<string>, IOrd<Unit>, IProduct, IFromIterator<Unit, Unit> { 17 18 #region Type-level Constructors 19 #endregion 20 21 #region Instance Constructors 22 [MethodImpl(MethodImplOptions.AggressiveInlining)] 23 public Unit(){} 24 #endregion 25 26 #region Type-level Fields 27 #endregion 28 29 #region Instance Fields 30 #endregion 31 32 #region Type-level Properties 33 #endregion 34 35 #region Instance Properties 36 #endregion 37 38 #region Type-level Functions 39 public static Unit New() => new(); 40 public static Unit FromIter<TIter>(TIter iter) where TIter: notnull, IIterator<Unit> => iter.ForEach<TIter, Unit>((_) => new()); 41 #endregion 42 43 #region Instance Functions 44 public readonly Unit Clone() => this; 45 public readonly Ordering Cmp(in Unit _) => Ordering.Equivalent; 46 public readonly bool Equals(in Unit _) => true; 47 public override readonly bool Equals(object? _) => false; 48 public readonly Unit Extend<TIter>(TIter iter) where TIter: notnull, IIterator<Unit> => iter.ForEach<TIter, Unit>((_) => new()); 49 public readonly Unit ExtendOne(Unit _) => this; 50 public readonly Unit ExtendReserve(uint _) => this; 51 public override readonly int GetHashCode() => 0; 52 public readonly Unit Hash<THasher>(ref THasher _) where THasher: notnull, IHasher => new(); 53 public readonly Unit Into() => this; 54 public readonly Unit IntoUnit() => this; 55 public readonly void IntoVoid(){} 56 public readonly string IntoString() => ToString(); 57 readonly string IInto<string>.Into() => IntoString(); 58 public readonly Maybe<Ordering> PartialCmp(in Unit _) => new(Ordering.Equivalent); 59 public override readonly string ToString() => "()"; 60 readonly Result<Unit, Bottom> ITryInto<Unit, Bottom>.TryInto() => OK(this); 61 readonly Result<string, Bottom> ITryInto<string, Bottom>.TryInto() => new(ToString()); 62 #endregion 63 64 #region Operators 65 public static bool operator !=(Unit _, Unit _1) => false; 66 public static bool operator <(Unit _, Unit _1) => false; 67 public static bool operator <=(Unit _, Unit _1) => true; 68 public static bool operator ==(Unit _, Unit _1) => true; 69 public static bool operator >(Unit _, Unit _1) => false; 70 public static bool operator >=(Unit _, Unit _1) => true; 71 #endregion 72 73 #region Types 74 #endregion 75 } 76 #endregion 77 78 #region Namespaces 79 #endregion 80 } 81 #endregion