TryFromIntError.cs (2399B)
1 using Std.Clone; 2 using Std.Cmp; 3 using Std.Convert; 4 using Std.Error; 5 using Std.Hashing; 6 using Std.Maybe; 7 using Std.Result; 8 using static Std.Result.Result<Std.Num.TryFromIntError, Std.Bottom>; 9 using System.Diagnostics; 10 using System.Runtime.InteropServices; 11 #region Namespaces 12 namespace Std.Num { 13 #region Types 14 [StructLayout(LayoutKind.Explicit, CharSet = CharSet.Unicode, Pack = 1, Size = 1)] 15 public readonly struct TryFromIntError: IClone<TryFromIntError>, IEquality<TryFromIntError>, IError, IHashable, IInto<TryFromIntError> { 16 17 #region Type-level Constructors 18 #endregion 19 20 #region Instance Constructors 21 public TryFromIntError(){} 22 #endregion 23 24 #region Type-level Fields 25 public static readonly TryFromIntError OverflowOrUnderflow = new(); 26 #endregion 27 28 #region Instance Fields 29 #endregion 30 31 #region Type-level Properties 32 #endregion 33 34 #region Instance Properties 35 #endregion 36 37 #region Type-level Functions 38 #endregion 39 40 #region Instance Functions 41 public readonly TryFromIntError Clone() => this; 42 public readonly bool Equals(in TryFromIntError _) => true; 43 public override readonly bool Equals(object? _) => false; 44 public override readonly int GetHashCode() => 0; 45 public readonly Unit Hash<THasher>(ref THasher _) where THasher: notnull, IHasher => new Unit(); 46 public readonly TryFromIntError Into() => this; 47 public readonly string IntoString() => ToString(); 48 readonly string IInto<string>.Into() => IntoString(); 49 public readonly Maybe<IError> Source() => Maybe<IError>.None(); 50 public readonly Maybe<StackTrace> StackTrace() => Maybe<StackTrace>.None(); 51 public override readonly string ToString() => "OverflowOrUnderflow"; 52 readonly Result<TryFromIntError, Bottom> ITryInto<TryFromIntError, Bottom>.TryInto() => OK(this); 53 readonly Result<string, Bottom> ITryInto<string, Bottom>.TryInto() => new(ToString()); 54 #endregion 55 56 #region Operators 57 public static bool operator !=(TryFromIntError _, TryFromIntError _1) => false; 58 public static bool operator ==(TryFromIntError _, TryFromIntError _1) => true; 59 #endregion 60 61 #region Types 62 #endregion 63 } 64 #endregion 65 66 #region Namespaces 67 #endregion 68 } 69 #endregion