using System.Diagnostics.Contracts; namespace InnovEnergy.Lib.Utils; // taken from https://github.com/louthy/language-ext/blob/main/LanguageExt.Core/DataTypes/Unit/Unit.cs /// /// A unit type is a type that allows only one value (and thus can hold no information) /// [Serializable] public readonly struct None : IEquatable, IComparable { // ReSharper disable once InconsistentNaming public static readonly None none = new None(); [Pure] public override Int32 GetHashCode() => 0; [Pure] public override Boolean Equals(Object? obj) => obj is None; [Pure] public override String ToString() => ""; [Pure] public Boolean Equals(None other) => true; [Pure] public static Boolean operator ==(None lhs, None rhs) => true; [Pure] public static Boolean operator !=(None lhs, None rhs) => false; [Pure] public static Boolean operator > (None lhs, None rhs) => false; [Pure] public static Boolean operator >=(None lhs, None rhs) => true; [Pure] public static Boolean operator < (None lhs, None rhs) => false; [Pure] public static Boolean operator <=(None lhs, None rhs) => true; [Pure] public Int32 CompareTo(None other) => 0; [Pure] public static None operator +(None a, None b) => none; [Pure] public static implicit operator ValueTuple(None _) => default; [Pure] public static implicit operator None(ValueTuple _) => default; }