NonZero.cs (67479B)
1 using Std.Clone; 2 using Std.Cmp; 3 using Std.Convert; 4 using Std.Hashing; 5 using Std.Maybe; 6 using Std.Result; 7 using System; 8 using System.Runtime.InteropServices; 9 #region Namespaces 10 namespace Std.Num { 11 #region Types 12 #pragma warning disable CA1066, CA1815, CA2231, IDE0078 13 [StructLayout(LayoutKind.Explicit, CharSet = CharSet.Unicode, Pack = 1, Size = 1)] 14 public readonly struct NonZeroByte: IClone<NonZeroByte>, IEquality<NonZeroByte>, IHashable, IInto<NonZeroByte>, IInto<NonZeroI128>, IInto<NonZeroInt>, IInto<NonZeroLong>, IInto<NonZeroShort>, IInto<NonZeroU128>, IInto<NonZeroUint>, IInto<NonZeroUlong>, IInto<NonZeroUshort>, IInto<byte>, IInto<string>, IOrd<NonZeroByte>, ITryInto<NonZeroSbyte, TryIntoIntError>, ITryFrom<NonZeroByte, byte, TryFromIntError> { 15 16 #region Type-level Constructors 17 #endregion 18 19 #region Instance Constructors 20 public NonZeroByte() => throw new InvalidOperationException("Parameterless constructor is not allowed to be called!"); 21 internal NonZeroByte(byte val) => Value = val; 22 #endregion 23 24 #region Type-level Fields 25 #endregion 26 27 #region Instance Fields 28 [FieldOffset(0)] public readonly byte Value; 29 #endregion 30 31 #region Type-level Properties 32 #endregion 33 34 #region Instance Properties 35 #endregion 36 37 #region Type-level Functions 38 public static Prod<byte, byte> DivRem(NonZeroByte dividend, NonZeroByte divisor) => new((byte)Math.DivRem(dividend.Value, divisor.Value, out var res), (byte)res); 39 public static Maybe<NonZeroByte> New(byte val) => (uint)val == byte.MinValue ? Maybe<NonZeroByte>.None() : new(new(val)); 40 public static NonZeroByte NewUnsafe(byte val) => new(val); 41 public static Result<NonZeroByte, TryFromIntError> TryFrom(byte val) => New(val).OKOr(TryFromIntError.OverflowOrUnderflow); 42 #endregion 43 44 #region Instance Functions 45 public readonly NonZeroByte Clone() => this; 46 public readonly Ordering Cmp(in NonZeroByte other) => Value.CompareTo(other.Value) switch { 47 < 0 => Ordering.Less, 48 0 => Ordering.Equivalent, 49 _ => Ordering.Greater, 50 }; 51 public readonly bool Equals(in NonZeroByte other) => Value == other.Value; 52 public override readonly bool Equals(object? _) => false; 53 public override readonly int GetHashCode() => 0; 54 public readonly Unit Hash<THasher>(ref THasher hasher) where THasher: notnull, IHasher => hasher.WriteUnsafe(this); 55 public readonly NonZeroByte Into() => this; 56 public readonly byte IntoByte() => Value; 57 public readonly NonZeroI128 IntoNonZeroI128() => new((I128)Value); 58 readonly NonZeroI128 IInto<NonZeroI128>.Into() => IntoNonZeroI128(); 59 public readonly NonZeroInt IntoNonZeroInt() => new(Value); 60 readonly NonZeroInt IInto<NonZeroInt>.Into() => IntoNonZeroInt(); 61 public readonly NonZeroLong IntoNonZeroLong() => new(Value); 62 readonly NonZeroLong IInto<NonZeroLong>.Into() => IntoNonZeroLong(); 63 public readonly NonZeroShort IntoNonZeroShort() => new(Value); 64 readonly NonZeroShort IInto<NonZeroShort>.Into() => IntoNonZeroShort(); 65 public readonly NonZeroU128 IntoNonZeroU128() => new((U128)Value); 66 readonly NonZeroU128 IInto<NonZeroU128>.Into() => IntoNonZeroU128(); 67 public readonly NonZeroUint IntoNonZeroUint() => new(Value); 68 readonly NonZeroUint IInto<NonZeroUint>.Into() => IntoNonZeroUint(); 69 public readonly NonZeroUlong IntoNonZeroUlong() => new(Value); 70 readonly NonZeroUlong IInto<NonZeroUlong>.Into() => IntoNonZeroUlong(); 71 public readonly NonZeroUshort IntoNonZeroUshort() => new(Value); 72 readonly NonZeroUshort IInto<NonZeroUshort>.Into() => IntoNonZeroUshort(); 73 public readonly string IntoString() => ToString(); 74 readonly byte IInto<byte>.Into() => IntoByte(); 75 readonly string IInto<string>.Into() => IntoString(); 76 public readonly Maybe<Ordering> PartialCmp(in NonZeroByte other) => new(Cmp(in other)); 77 public override readonly string ToString() => Value.ToString(); 78 readonly Result<NonZeroByte, Bottom> ITryInto<NonZeroByte, Bottom>.TryInto() => new(this); 79 readonly Result<string, Bottom> ITryInto<string, Bottom>.TryInto() => new(ToString()); 80 readonly Result<byte, Bottom> ITryInto<byte, Bottom>.TryInto() => new(IntoByte()); 81 readonly Result<NonZeroI128, Bottom> ITryInto<NonZeroI128, Bottom>.TryInto() => new(IntoNonZeroI128()); 82 readonly Result<NonZeroInt, Bottom> ITryInto<NonZeroInt, Bottom>.TryInto() => new(IntoNonZeroInt()); 83 readonly Result<NonZeroLong, Bottom> ITryInto<NonZeroLong, Bottom>.TryInto() => new(IntoNonZeroLong()); 84 public readonly Result<NonZeroSbyte, TryIntoIntError> TryIntoNonZeroSbyte() => Value > (uint)sbyte.MaxValue ? new(TryIntoIntError.Overflow) : new(new NonZeroSbyte((sbyte)Value)); 85 readonly Result<NonZeroSbyte, TryIntoIntError> ITryInto<NonZeroSbyte, TryIntoIntError>.TryInto() => TryIntoNonZeroSbyte(); 86 readonly Result<NonZeroShort, Bottom> ITryInto<NonZeroShort, Bottom>.TryInto() => new(IntoNonZeroShort()); 87 readonly Result<NonZeroU128, Bottom> ITryInto<NonZeroU128, Bottom>.TryInto() => new(IntoNonZeroU128()); 88 readonly Result<NonZeroUint, Bottom> ITryInto<NonZeroUint, Bottom>.TryInto() => new(IntoNonZeroUint()); 89 readonly Result<NonZeroUlong, Bottom> ITryInto<NonZeroUlong, Bottom>.TryInto() => new(IntoNonZeroUlong()); 90 readonly Result<NonZeroUshort, Bottom> ITryInto<NonZeroUshort, Bottom>.TryInto() => new(IntoNonZeroUshort()); 91 #endregion 92 93 #region Operators 94 public static bool operator !=(NonZeroByte val0, NonZeroByte val1) => val0.Value != val1.Value; 95 public static byte operator %(NonZeroByte dividend, NonZeroByte divisor) => (byte)((uint)dividend.Value % divisor.Value); 96 public static byte operator /(NonZeroByte dividend, NonZeroByte divisor) => (byte)((uint)dividend.Value / divisor.Value); 97 public static bool operator <(NonZeroByte val0, NonZeroByte val1) => val0.Value < val1.Value; 98 public static bool operator <=(NonZeroByte val0, NonZeroByte val1) => val0.Value <= val1.Value; 99 public static bool operator ==(NonZeroByte val0, NonZeroByte val1) => val0.Value == val1.Value; 100 public static bool operator >(NonZeroByte val0, NonZeroByte val1) => val0.Value > val1.Value; 101 public static bool operator >=(NonZeroByte val0, NonZeroByte val1) => val0.Value >= val1.Value; 102 public static NonZeroByte operator |(NonZeroByte val0, NonZeroByte val1) => new((byte)((uint)val0.Value | val1.Value)); 103 public static NonZeroByte operator |(NonZeroByte val0, byte val1) => new((byte)((uint)val0.Value | val1)); 104 #endregion 105 106 #region Types 107 #endregion 108 } 109 [StructLayout(LayoutKind.Explicit, CharSet = CharSet.Unicode, Pack = 2, Size = 2)] 110 public readonly struct NonZeroUshort: IClone<NonZeroUshort>, IEquality<NonZeroUshort>, IHashable, IInto<NonZeroUshort>, IInto<NonZeroI128>, IInto<NonZeroInt>, IInto<NonZeroLong>, IInto<NonZeroU128>, IInto<NonZeroUint>, IInto<NonZeroUlong>, IInto<ushort>, IInto<string>, IOrd<NonZeroUshort>, ITryInto<NonZeroByte, TryIntoIntError>, ITryInto<NonZeroSbyte, TryIntoIntError>, ITryInto<NonZeroShort, TryIntoIntError>, ITryFrom<NonZeroUshort, ushort, TryFromIntError> { 111 112 #region Type-level Constructors 113 #endregion 114 115 #region Instance Constructors 116 public NonZeroUshort() => throw new InvalidOperationException("Parameterless constructor is not allowed to be called!"); 117 internal NonZeroUshort(ushort val) => Value = val; 118 #endregion 119 120 #region Type-level Fields 121 #endregion 122 123 #region Instance Fields 124 [FieldOffset(0)] public readonly ushort Value; 125 #endregion 126 127 #region Type-level Properties 128 #endregion 129 130 #region Instance Properties 131 #endregion 132 133 #region Type-level Functions 134 public static Prod<ushort, ushort> DivRem(NonZeroUshort dividend, NonZeroUshort divisor) => new((ushort)Math.DivRem(dividend.Value, divisor.Value, out var res), (ushort)res); 135 public static Maybe<NonZeroUshort> New(ushort val) => (uint)val == ushort.MinValue ? Maybe<NonZeroUshort>.None() : new(new(val)); 136 public static NonZeroUshort NewUnsafe(ushort val) => new(val); 137 public static Result<NonZeroUshort, TryFromIntError> TryFrom(ushort val) => New(val).OKOr(TryFromIntError.OverflowOrUnderflow); 138 #endregion 139 140 #region Instance Functions 141 public readonly NonZeroUshort Clone() => this; 142 public readonly Ordering Cmp(in NonZeroUshort other) => Value.CompareTo(other.Value) switch { 143 < 0 => Ordering.Less, 144 0 => Ordering.Equivalent, 145 _ => Ordering.Greater, 146 }; 147 public readonly bool Equals(in NonZeroUshort other) => Value == other.Value; 148 public override readonly bool Equals(object? _) => false; 149 public override readonly int GetHashCode() => 0; 150 public readonly Unit Hash<THasher>(ref THasher hasher) where THasher: notnull, IHasher => hasher.WriteUnsafe(this); 151 public readonly NonZeroUshort Into() => this; 152 public readonly ushort IntoUshort() => Value; 153 public readonly NonZeroI128 IntoNonZeroI128() => new((I128)Value); 154 readonly NonZeroI128 IInto<NonZeroI128>.Into() => IntoNonZeroI128(); 155 public readonly NonZeroInt IntoNonZeroInt() => new(Value); 156 readonly NonZeroInt IInto<NonZeroInt>.Into() => IntoNonZeroInt(); 157 public readonly NonZeroLong IntoNonZeroLong() => new(Value); 158 readonly NonZeroLong IInto<NonZeroLong>.Into() => IntoNonZeroLong(); 159 public readonly NonZeroU128 IntoNonZeroU128() => new((U128)Value); 160 readonly NonZeroU128 IInto<NonZeroU128>.Into() => IntoNonZeroU128(); 161 public readonly NonZeroUint IntoNonZeroUint() => new(Value); 162 readonly NonZeroUint IInto<NonZeroUint>.Into() => IntoNonZeroUint(); 163 public readonly NonZeroUlong IntoNonZeroUlong() => new(Value); 164 readonly NonZeroUlong IInto<NonZeroUlong>.Into() => IntoNonZeroUlong(); 165 public readonly string IntoString() => ToString(); 166 readonly ushort IInto<ushort>.Into() => IntoUshort(); 167 readonly string IInto<string>.Into() => IntoString(); 168 public readonly Maybe<Ordering> PartialCmp(in NonZeroUshort other) => new(Cmp(in other)); 169 public override readonly string ToString() => Value.ToString(); 170 readonly Result<NonZeroUshort, Bottom> ITryInto<NonZeroUshort, Bottom>.TryInto() => new(this); 171 readonly Result<string, Bottom> ITryInto<string, Bottom>.TryInto() => new(ToString()); 172 readonly Result<ushort, Bottom> ITryInto<ushort, Bottom>.TryInto() => new(IntoUshort()); 173 readonly Result<NonZeroI128, Bottom> ITryInto<NonZeroI128, Bottom>.TryInto() => new(IntoNonZeroI128()); 174 readonly Result<NonZeroInt, Bottom> ITryInto<NonZeroInt, Bottom>.TryInto() => new(IntoNonZeroInt()); 175 readonly Result<NonZeroLong, Bottom> ITryInto<NonZeroLong, Bottom>.TryInto() => new(IntoNonZeroLong()); 176 public readonly Result<NonZeroByte, TryIntoIntError> TryIntoNonZeroByte() => Value > (uint)byte.MaxValue ? new(TryIntoIntError.Overflow) : new(new NonZeroByte((byte)Value)); 177 readonly Result<NonZeroByte, TryIntoIntError> ITryInto<NonZeroByte, TryIntoIntError>.TryInto() => TryIntoNonZeroByte(); 178 public readonly Result<NonZeroSbyte, TryIntoIntError> TryIntoNonZeroSbyte() => Value > (uint)sbyte.MaxValue ? new(TryIntoIntError.Overflow) : new(new NonZeroSbyte((sbyte)Value)); 179 readonly Result<NonZeroSbyte, TryIntoIntError> ITryInto<NonZeroSbyte, TryIntoIntError>.TryInto() => TryIntoNonZeroSbyte(); 180 public readonly Result<NonZeroShort, TryIntoIntError> TryIntoNonZeroShort() => Value > (uint)short.MaxValue ? new(TryIntoIntError.Overflow) : new(new NonZeroShort((short)Value)); 181 readonly Result<NonZeroShort, TryIntoIntError> ITryInto<NonZeroShort, TryIntoIntError>.TryInto() => TryIntoNonZeroShort(); 182 readonly Result<NonZeroU128, Bottom> ITryInto<NonZeroU128, Bottom>.TryInto() => new(IntoNonZeroU128()); 183 readonly Result<NonZeroUint, Bottom> ITryInto<NonZeroUint, Bottom>.TryInto() => new(IntoNonZeroUint()); 184 readonly Result<NonZeroUlong, Bottom> ITryInto<NonZeroUlong, Bottom>.TryInto() => new(IntoNonZeroUlong()); 185 #endregion 186 187 #region Operators 188 public static bool operator !=(NonZeroUshort val0, NonZeroUshort val1) => val0.Value != val1.Value; 189 public static ushort operator %(NonZeroUshort dividend, NonZeroUshort divisor) => (ushort)((uint)dividend.Value % divisor.Value); 190 public static ushort operator /(NonZeroUshort dividend, NonZeroUshort divisor) => (ushort)((uint)dividend.Value / divisor.Value); 191 public static bool operator <(NonZeroUshort val0, NonZeroUshort val1) => val0.Value < val1.Value; 192 public static bool operator <=(NonZeroUshort val0, NonZeroUshort val1) => val0.Value <= val1.Value; 193 public static bool operator ==(NonZeroUshort val0, NonZeroUshort val1) => val0.Value == val1.Value; 194 public static bool operator >(NonZeroUshort val0, NonZeroUshort val1) => val0.Value > val1.Value; 195 public static bool operator >=(NonZeroUshort val0, NonZeroUshort val1) => val0.Value >= val1.Value; 196 public static NonZeroUshort operator |(NonZeroUshort val0, NonZeroUshort val1) => new((ushort)((uint)val0.Value | val1.Value)); 197 public static NonZeroUshort operator |(NonZeroUshort val0, ushort val1) => new((ushort)((uint)val0.Value | val1)); 198 #endregion 199 200 #region Types 201 #endregion 202 } 203 [StructLayout(LayoutKind.Explicit, CharSet = CharSet.Unicode, Pack = 4, Size = 4)] 204 public readonly struct NonZeroUint: IClone<NonZeroUint>, IEquality<NonZeroUint>, IHashable, IInto<NonZeroUint>, IInto<NonZeroI128>, IInto<NonZeroLong>, IInto<NonZeroU128>, IInto<NonZeroUlong>, IInto<uint>, IInto<string>, IOrd<NonZeroUint>, ITryInto<NonZeroByte, TryIntoIntError>, ITryInto<NonZeroSbyte, TryIntoIntError>, ITryInto<NonZeroShort, TryIntoIntError>, ITryInto<NonZeroUshort, TryIntoIntError>, ITryInto<NonZeroInt, TryIntoIntError>, ITryFrom<NonZeroUint, uint, TryFromIntError> { 205 206 #region Type-level Constructors 207 #endregion 208 209 #region Instance Constructors 210 public NonZeroUint() => throw new InvalidOperationException("Parameterless constructor is not allowed to be called!"); 211 internal NonZeroUint(uint val) => Value = val; 212 #endregion 213 214 #region Type-level Fields 215 #endregion 216 217 #region Instance Fields 218 [FieldOffset(0)] public readonly uint Value; 219 #endregion 220 221 #region Type-level Properties 222 #endregion 223 224 #region Instance Properties 225 #endregion 226 227 #region Type-level Functions 228 public static Prod<uint, uint> DivRem(NonZeroUint dividend, NonZeroUint divisor) => new((uint)Math.DivRem(dividend.Value, divisor.Value, out var res), (uint)res); 229 public static Maybe<NonZeroUint> New(uint val) => val == uint.MinValue ? Maybe<NonZeroUint>.None() : new(new(val)); 230 public static NonZeroUint NewUnsafe(uint val) => new(val); 231 public static Result<NonZeroUint, TryFromIntError> TryFrom(uint val) => New(val).OKOr(TryFromIntError.OverflowOrUnderflow); 232 #endregion 233 234 #region Instance Functions 235 public readonly NonZeroUint Clone() => this; 236 public readonly Ordering Cmp(in NonZeroUint other) => Value.CompareTo(other.Value) switch { 237 < 0 => Ordering.Less, 238 0 => Ordering.Equivalent, 239 _ => Ordering.Greater, 240 }; 241 public readonly bool Equals(in NonZeroUint other) => Value == other.Value; 242 public override readonly bool Equals(object? _) => false; 243 public override readonly int GetHashCode() => 0; 244 public readonly Unit Hash<THasher>(ref THasher hasher) where THasher: notnull, IHasher => hasher.WriteUnsafe(this); 245 public readonly NonZeroUint Into() => this; 246 public readonly uint IntoUint() => Value; 247 public readonly NonZeroI128 IntoNonZeroI128() => new((I128)Value); 248 readonly NonZeroI128 IInto<NonZeroI128>.Into() => IntoNonZeroI128(); 249 public readonly NonZeroLong IntoNonZeroLong() => new(Value); 250 readonly NonZeroLong IInto<NonZeroLong>.Into() => IntoNonZeroLong(); 251 public readonly NonZeroU128 IntoNonZeroU128() => new((U128)Value); 252 readonly NonZeroU128 IInto<NonZeroU128>.Into() => IntoNonZeroU128(); 253 public readonly NonZeroUlong IntoNonZeroUlong() => new(Value); 254 readonly NonZeroUlong IInto<NonZeroUlong>.Into() => IntoNonZeroUlong(); 255 public readonly string IntoString() => ToString(); 256 readonly uint IInto<uint>.Into() => IntoUint(); 257 readonly string IInto<string>.Into() => IntoString(); 258 public readonly Maybe<Ordering> PartialCmp(in NonZeroUint other) => new(Cmp(in other)); 259 public override readonly string ToString() => Value.ToString(); 260 readonly Result<NonZeroUint, Bottom> ITryInto<NonZeroUint, Bottom>.TryInto() => new(this); 261 readonly Result<string, Bottom> ITryInto<string, Bottom>.TryInto() => new(ToString()); 262 readonly Result<uint, Bottom> ITryInto<uint, Bottom>.TryInto() => new(IntoUint()); 263 readonly Result<NonZeroI128, Bottom> ITryInto<NonZeroI128, Bottom>.TryInto() => new(IntoNonZeroI128()); 264 readonly Result<NonZeroLong, Bottom> ITryInto<NonZeroLong, Bottom>.TryInto() => new(IntoNonZeroLong()); 265 public readonly Result<NonZeroByte, TryIntoIntError> TryIntoNonZeroByte() => Value > byte.MaxValue ? new(TryIntoIntError.Overflow) : new(new NonZeroByte((byte)Value)); 266 readonly Result<NonZeroByte, TryIntoIntError> ITryInto<NonZeroByte, TryIntoIntError>.TryInto() => TryIntoNonZeroByte(); 267 public readonly Result<NonZeroSbyte, TryIntoIntError> TryIntoNonZeroSbyte() => Value > (uint)sbyte.MaxValue ? new(TryIntoIntError.Overflow) : new(new NonZeroSbyte((sbyte)Value)); 268 readonly Result<NonZeroSbyte, TryIntoIntError> ITryInto<NonZeroSbyte, TryIntoIntError>.TryInto() => TryIntoNonZeroSbyte(); 269 public readonly Result<NonZeroShort, TryIntoIntError> TryIntoNonZeroShort() => Value > (uint)short.MaxValue ? new(TryIntoIntError.Overflow) : new(new NonZeroShort((short)Value)); 270 readonly Result<NonZeroShort, TryIntoIntError> ITryInto<NonZeroShort, TryIntoIntError>.TryInto() => TryIntoNonZeroShort(); 271 public readonly Result<NonZeroInt, TryIntoIntError> TryIntoNonZeroInt() => Value > int.MaxValue ? new(TryIntoIntError.Overflow) : new(new NonZeroInt((int)Value)); 272 readonly Result<NonZeroInt, TryIntoIntError> ITryInto<NonZeroInt, TryIntoIntError>.TryInto() => TryIntoNonZeroInt(); 273 public readonly Result<NonZeroUshort, TryIntoIntError> TryIntoNonZeroUshort() => Value > ushort.MaxValue ? new(TryIntoIntError.Overflow) : new(new NonZeroUshort((ushort)Value)); 274 readonly Result<NonZeroUshort, TryIntoIntError> ITryInto<NonZeroUshort, TryIntoIntError>.TryInto() => TryIntoNonZeroUshort(); 275 readonly Result<NonZeroU128, Bottom> ITryInto<NonZeroU128, Bottom>.TryInto() => new(IntoNonZeroU128()); 276 readonly Result<NonZeroUlong, Bottom> ITryInto<NonZeroUlong, Bottom>.TryInto() => new(IntoNonZeroUlong()); 277 #endregion 278 279 #region Operators 280 public static bool operator !=(NonZeroUint val0, NonZeroUint val1) => val0.Value != val1.Value; 281 public static uint operator %(NonZeroUint dividend, NonZeroUint divisor) => dividend.Value % divisor.Value; 282 public static uint operator /(NonZeroUint dividend, NonZeroUint divisor) => dividend.Value / divisor.Value; 283 public static bool operator <(NonZeroUint val0, NonZeroUint val1) => val0.Value < val1.Value; 284 public static bool operator <=(NonZeroUint val0, NonZeroUint val1) => val0.Value <= val1.Value; 285 public static bool operator ==(NonZeroUint val0, NonZeroUint val1) => val0.Value == val1.Value; 286 public static bool operator >(NonZeroUint val0, NonZeroUint val1) => val0.Value > val1.Value; 287 public static bool operator >=(NonZeroUint val0, NonZeroUint val1) => val0.Value >= val1.Value; 288 public static NonZeroUint operator |(NonZeroUint val0, NonZeroUint val1) => new(val0.Value | val1.Value); 289 public static NonZeroUint operator |(NonZeroUint val0, uint val1) => new(val0.Value | val1); 290 #endregion 291 292 #region Types 293 #endregion 294 } 295 [StructLayout(LayoutKind.Explicit, CharSet = CharSet.Unicode, Pack = 8, Size = 8)] 296 public readonly struct NonZeroUlong: IClone<NonZeroUlong>, IEquality<NonZeroUlong>, IHashable, IInto<NonZeroUlong>, IInto<NonZeroI128>, IInto<NonZeroU128>, IInto<ulong>, IInto<string>, IOrd<NonZeroUlong>, ITryInto<NonZeroByte, TryIntoIntError>, ITryInto<NonZeroSbyte, TryIntoIntError>, ITryInto<NonZeroShort, TryIntoIntError>, ITryInto<NonZeroUshort, TryIntoIntError>, ITryInto<NonZeroInt, TryIntoIntError>, ITryInto<NonZeroUint, TryIntoIntError>, ITryInto<NonZeroLong, TryIntoIntError>, ITryFrom<NonZeroUlong, ulong, TryFromIntError> { 297 298 #region Type-level Constructors 299 #endregion 300 301 #region Instance Constructors 302 public NonZeroUlong() => throw new InvalidOperationException("Parameterless constructor is not allowed to be called!"); 303 internal NonZeroUlong(ulong val) => Value = val; 304 #endregion 305 306 #region Type-level Fields 307 #endregion 308 309 #region Instance Fields 310 [FieldOffset(0)] public readonly ulong Value; 311 #endregion 312 313 #region Type-level Properties 314 #endregion 315 316 #region Instance Properties 317 #endregion 318 319 #region Type-level Functions 320 public static Prod<ulong, ulong> DivRem(NonZeroUlong dividend, NonZeroUlong divisor) => new(dividend.Value / divisor.Value, dividend.Value % divisor.Value); 321 public static Maybe<NonZeroUlong> New(ulong val) => val == ulong.MinValue ? Maybe<NonZeroUlong>.None() : new(new(val)); 322 public static NonZeroUlong NewUnsafe(ulong val) => new(val); 323 public static Result<NonZeroUlong, TryFromIntError> TryFrom(ulong val) => New(val).OKOr(TryFromIntError.OverflowOrUnderflow); 324 #endregion 325 326 #region Instance Functions 327 public readonly NonZeroUlong Clone() => this; 328 public readonly Ordering Cmp(in NonZeroUlong other) => Value.CompareTo(other.Value) switch { 329 < 0 => Ordering.Less, 330 0 => Ordering.Equivalent, 331 _ => Ordering.Greater, 332 }; 333 public readonly bool Equals(in NonZeroUlong other) => Value == other.Value; 334 public override readonly bool Equals(object? _) => false; 335 public override readonly int GetHashCode() => 0; 336 public readonly Unit Hash<THasher>(ref THasher hasher) where THasher: notnull, IHasher => hasher.WriteUnsafe(this); 337 public readonly NonZeroUlong Into() => this; 338 public readonly ulong IntoUlong() => Value; 339 public readonly NonZeroI128 IntoNonZeroI128() => new((I128)Value); 340 readonly NonZeroI128 IInto<NonZeroI128>.Into() => IntoNonZeroI128(); 341 public readonly NonZeroU128 IntoNonZeroU128() => new((U128)Value); 342 readonly NonZeroU128 IInto<NonZeroU128>.Into() => IntoNonZeroU128(); 343 public readonly string IntoString() => ToString(); 344 readonly ulong IInto<ulong>.Into() => IntoUlong(); 345 readonly string IInto<string>.Into() => IntoString(); 346 public readonly Maybe<Ordering> PartialCmp(in NonZeroUlong other) => new(Cmp(in other)); 347 public override readonly string ToString() => Value.ToString(); 348 readonly Result<NonZeroUlong, Bottom> ITryInto<NonZeroUlong, Bottom>.TryInto() => new(this); 349 readonly Result<string, Bottom> ITryInto<string, Bottom>.TryInto() => new(ToString()); 350 readonly Result<ulong, Bottom> ITryInto<ulong, Bottom>.TryInto() => new(IntoUlong()); 351 readonly Result<NonZeroI128, Bottom> ITryInto<NonZeroI128, Bottom>.TryInto() => new(IntoNonZeroI128()); 352 public readonly Result<NonZeroByte, TryIntoIntError> TryIntoNonZeroByte() => Value > byte.MaxValue ? new(TryIntoIntError.Overflow) : new(new NonZeroByte((byte)Value)); 353 readonly Result<NonZeroByte, TryIntoIntError> ITryInto<NonZeroByte, TryIntoIntError>.TryInto() => TryIntoNonZeroByte(); 354 public readonly Result<NonZeroSbyte, TryIntoIntError> TryIntoNonZeroSbyte() => Value > (uint)sbyte.MaxValue ? new(TryIntoIntError.Overflow) : new(new NonZeroSbyte((sbyte)Value)); 355 readonly Result<NonZeroSbyte, TryIntoIntError> ITryInto<NonZeroSbyte, TryIntoIntError>.TryInto() => TryIntoNonZeroSbyte(); 356 public readonly Result<NonZeroShort, TryIntoIntError> TryIntoNonZeroShort() => Value > (uint)short.MaxValue ? new(TryIntoIntError.Overflow) : new(new NonZeroShort((short)Value)); 357 readonly Result<NonZeroShort, TryIntoIntError> ITryInto<NonZeroShort, TryIntoIntError>.TryInto() => TryIntoNonZeroShort(); 358 public readonly Result<NonZeroUshort, TryIntoIntError> TryIntoNonZeroUshort() => Value > ushort.MaxValue ? new(TryIntoIntError.Overflow) : new(new NonZeroUshort((ushort)Value)); 359 readonly Result<NonZeroUshort, TryIntoIntError> ITryInto<NonZeroUshort, TryIntoIntError>.TryInto() => TryIntoNonZeroUshort(); 360 public readonly Result<NonZeroInt, TryIntoIntError> TryIntoNonZeroInt() => Value > int.MaxValue ? new(TryIntoIntError.Overflow) : new(new NonZeroInt((int)Value)); 361 readonly Result<NonZeroInt, TryIntoIntError> ITryInto<NonZeroInt, TryIntoIntError>.TryInto() => TryIntoNonZeroInt(); 362 public readonly Result<NonZeroUint, TryIntoIntError> TryIntoNonZeroUint() => Value > uint.MaxValue ? new(TryIntoIntError.Overflow) : new(new NonZeroUint((uint)Value)); 363 readonly Result<NonZeroUint, TryIntoIntError> ITryInto<NonZeroUint, TryIntoIntError>.TryInto() => TryIntoNonZeroUint(); 364 public readonly Result<NonZeroLong, TryIntoIntError> TryIntoNonZeroLong() => Value > long.MaxValue ? new(TryIntoIntError.Overflow) : new(new NonZeroLong((long)Value)); 365 readonly Result<NonZeroLong, TryIntoIntError> ITryInto<NonZeroLong, TryIntoIntError>.TryInto() => TryIntoNonZeroLong(); 366 readonly Result<NonZeroU128, Bottom> ITryInto<NonZeroU128, Bottom>.TryInto() => new(IntoNonZeroU128()); 367 #endregion 368 369 #region Operators 370 public static bool operator !=(NonZeroUlong val0, NonZeroUlong val1) => val0.Value != val1.Value; 371 public static ulong operator %(NonZeroUlong dividend, NonZeroUlong divisor) => dividend.Value % divisor.Value; 372 public static ulong operator /(NonZeroUlong dividend, NonZeroUlong divisor) => dividend.Value / divisor.Value; 373 public static bool operator <(NonZeroUlong val0, NonZeroUlong val1) => val0.Value < val1.Value; 374 public static bool operator <=(NonZeroUlong val0, NonZeroUlong val1) => val0.Value <= val1.Value; 375 public static bool operator ==(NonZeroUlong val0, NonZeroUlong val1) => val0.Value == val1.Value; 376 public static bool operator >(NonZeroUlong val0, NonZeroUlong val1) => val0.Value > val1.Value; 377 public static bool operator >=(NonZeroUlong val0, NonZeroUlong val1) => val0.Value >= val1.Value; 378 public static NonZeroUlong operator |(NonZeroUlong val0, NonZeroUlong val1) => new(val0.Value | val1.Value); 379 public static NonZeroUlong operator |(NonZeroUlong val0, ulong val1) => new(val0.Value | val1); 380 #endregion 381 382 #region Types 383 #endregion 384 } 385 [StructLayout(LayoutKind.Explicit, CharSet = CharSet.Unicode, Pack = 8, Size = 16)] 386 public readonly struct NonZeroU128: IClone<NonZeroU128>, IEquality<NonZeroU128>, IHashable, IInto<NonZeroU128>, IInto<U128>, IInto<string>, IOrd<NonZeroU128>, ITryInto<NonZeroByte, TryIntoIntError>, ITryInto<NonZeroSbyte, TryIntoIntError>, ITryInto<NonZeroShort, TryIntoIntError>, ITryInto<NonZeroUshort, TryIntoIntError>, ITryInto<NonZeroInt, TryIntoIntError>, ITryInto<NonZeroUint, TryIntoIntError>, ITryInto<NonZeroLong, TryIntoIntError>, ITryInto<NonZeroUlong, TryIntoIntError>, ITryInto<NonZeroI128, TryIntoIntError> { 387 388 #region Type-level Constructors 389 #endregion 390 391 #region Instance Constructors 392 public NonZeroU128() => throw new InvalidOperationException("Parameterless constructor is not allowed to be called!"); 393 internal NonZeroU128(U128 val) => Value = val; 394 #endregion 395 396 #region Type-level Fields 397 #endregion 398 399 #region Instance Fields 400 [FieldOffset(0)] public readonly U128 Value; 401 #endregion 402 403 #region Type-level Properties 404 #endregion 405 406 #region Instance Properties 407 #endregion 408 409 #region Type-level Functions 410 public static Prod<U128, U128> DivRem(NonZeroU128 dividend, NonZeroU128 divisor) => U128.DivRem(dividend.Value, divisor.Value); 411 public static Maybe<NonZeroU128> New(U128 val) => val == U128.MinValue ? Maybe<NonZeroU128>.None() : new(new(val)); 412 public static NonZeroU128 NewUnsafe(U128 val) => new(val); 413 #endregion 414 415 #region Instance Functions 416 public readonly NonZeroU128 Clone() => this; 417 public readonly Ordering Cmp(in NonZeroU128 other) => Value.Cmp(in other.Value); 418 public readonly bool Equals(in NonZeroU128 other) => Value == other.Value; 419 public override readonly bool Equals(object? _) => false; 420 public override readonly int GetHashCode() => 0; 421 public readonly Unit Hash<THasher>(ref THasher hasher) where THasher: notnull, IHasher => hasher.WriteUnsafe(this); 422 public readonly NonZeroU128 Into() => this; 423 public readonly U128 IntoU128() => Value; 424 public readonly string IntoString() => ToString(); 425 readonly U128 IInto<U128>.Into() => IntoU128(); 426 readonly string IInto<string>.Into() => IntoString(); 427 public readonly Maybe<Ordering> PartialCmp(in NonZeroU128 other) => new(Cmp(in other)); 428 public override readonly string ToString() => Value.ToString(); 429 readonly Result<NonZeroU128, Bottom> ITryInto<NonZeroU128, Bottom>.TryInto() => new(this); 430 readonly Result<string, Bottom> ITryInto<string, Bottom>.TryInto() => new(ToString()); 431 readonly Result<U128, Bottom> ITryInto<U128, Bottom>.TryInto() => new(IntoU128()); 432 public readonly Result<NonZeroByte, TryIntoIntError> TryIntoNonZeroByte() => Value > (U128)byte.MaxValue ? new(TryIntoIntError.Overflow) : new(new NonZeroByte((byte)Value)); 433 readonly Result<NonZeroByte, TryIntoIntError> ITryInto<NonZeroByte, TryIntoIntError>.TryInto() => TryIntoNonZeroByte(); 434 public readonly Result<NonZeroSbyte, TryIntoIntError> TryIntoNonZeroSbyte() => Value > (U128)sbyte.MaxValue ? new(TryIntoIntError.Overflow) : new(new NonZeroSbyte((sbyte)Value)); 435 readonly Result<NonZeroSbyte, TryIntoIntError> ITryInto<NonZeroSbyte, TryIntoIntError>.TryInto() => TryIntoNonZeroSbyte(); 436 public readonly Result<NonZeroShort, TryIntoIntError> TryIntoNonZeroShort() => Value > (U128)short.MaxValue ? new(TryIntoIntError.Overflow) : new(new NonZeroShort((short)Value)); 437 readonly Result<NonZeroShort, TryIntoIntError> ITryInto<NonZeroShort, TryIntoIntError>.TryInto() => TryIntoNonZeroShort(); 438 public readonly Result<NonZeroUshort, TryIntoIntError> TryIntoNonZeroUshort() => Value > (U128)ushort.MaxValue ? new(TryIntoIntError.Overflow) : new(new NonZeroUshort((ushort)Value)); 439 readonly Result<NonZeroUshort, TryIntoIntError> ITryInto<NonZeroUshort, TryIntoIntError>.TryInto() => TryIntoNonZeroUshort(); 440 public readonly Result<NonZeroInt, TryIntoIntError> TryIntoNonZeroInt() => Value > (U128)int.MaxValue ? new(TryIntoIntError.Overflow) : new(new NonZeroInt((int)Value)); 441 readonly Result<NonZeroInt, TryIntoIntError> ITryInto<NonZeroInt, TryIntoIntError>.TryInto() => TryIntoNonZeroInt(); 442 public readonly Result<NonZeroUint, TryIntoIntError> TryIntoNonZeroUint() => Value > (U128)uint.MaxValue ? new(TryIntoIntError.Overflow) : new(new NonZeroUint((uint)Value)); 443 readonly Result<NonZeroUint, TryIntoIntError> ITryInto<NonZeroUint, TryIntoIntError>.TryInto() => TryIntoNonZeroUint(); 444 public readonly Result<NonZeroLong, TryIntoIntError> TryIntoNonZeroLong() => Value > (U128)long.MaxValue ? new(TryIntoIntError.Overflow) : new(new NonZeroLong((long)Value)); 445 readonly Result<NonZeroLong, TryIntoIntError> ITryInto<NonZeroLong, TryIntoIntError>.TryInto() => TryIntoNonZeroLong(); 446 public readonly Result<NonZeroUlong, TryIntoIntError> TryIntoNonZeroUlong() => Value > (U128)ulong.MaxValue ? new(TryIntoIntError.Overflow) : new(new NonZeroUlong((ulong)Value)); 447 readonly Result<NonZeroUlong, TryIntoIntError> ITryInto<NonZeroUlong, TryIntoIntError>.TryInto() => TryIntoNonZeroUlong(); 448 public readonly Result<NonZeroI128, TryIntoIntError> TryIntoNonZeroI128() => Value > (U128)I128.MaxValue ? new(TryIntoIntError.Overflow) : new(new NonZeroI128((I128)Value)); 449 readonly Result<NonZeroI128, TryIntoIntError> ITryInto<NonZeroI128, TryIntoIntError>.TryInto() => TryIntoNonZeroI128(); 450 #endregion 451 452 #region Operators 453 public static bool operator !=(NonZeroU128 val0, NonZeroU128 val1) => val0.Value != val1.Value; 454 public static U128 operator %(NonZeroU128 dividend, NonZeroU128 divisor) => DivRem(dividend, divisor).Item1; 455 public static U128 operator /(NonZeroU128 dividend, NonZeroU128 divisor) => DivRem(dividend, divisor).Item0; 456 public static bool operator <(NonZeroU128 val0, NonZeroU128 val1) => val0.Value < val1.Value; 457 public static bool operator <=(NonZeroU128 val0, NonZeroU128 val1) => val0.Value <= val1.Value; 458 public static bool operator ==(NonZeroU128 val0, NonZeroU128 val1) => val0.Value == val1.Value; 459 public static bool operator >(NonZeroU128 val0, NonZeroU128 val1) => val0.Value > val1.Value; 460 public static bool operator >=(NonZeroU128 val0, NonZeroU128 val1) => val0.Value >= val1.Value; 461 public static NonZeroU128 operator |(NonZeroU128 val0, NonZeroU128 val1) => new(val0.Value | val1.Value); 462 public static NonZeroU128 operator |(NonZeroU128 val0, U128 val1) => new(val0.Value | val1); 463 #endregion 464 465 #region Types 466 #endregion 467 } 468 [StructLayout(LayoutKind.Explicit, CharSet = CharSet.Unicode, Pack = 1, Size = 1)] 469 public readonly struct NonZeroSbyte: IClone<NonZeroSbyte>, IEquality<NonZeroSbyte>, IHashable, IInto<NonZeroSbyte>, IInto<NonZeroI128>, IInto<NonZeroInt>, IInto<NonZeroLong>, IInto<NonZeroShort>, IInto<sbyte>, IInto<string>, IOrd<NonZeroSbyte>, ITryInto<NonZeroByte, TryIntoIntError>, ITryInto<NonZeroUshort, TryIntoIntError>, ITryInto<NonZeroUint, TryIntoIntError>, ITryInto<NonZeroUlong, TryIntoIntError>, ITryInto<NonZeroU128, TryIntoIntError>, ITryFrom<NonZeroSbyte, sbyte, TryFromIntError> { 470 471 #region Type-level Constructors 472 #endregion 473 474 #region Instance Constructors 475 public NonZeroSbyte() => throw new InvalidOperationException("Parameterless constructor is not allowed to be called!"); 476 internal NonZeroSbyte(sbyte val) => Value = val; 477 #endregion 478 479 #region Type-level Fields 480 #endregion 481 482 #region Instance Fields 483 [FieldOffset(0)] public readonly sbyte Value; 484 #endregion 485 486 #region Type-level Properties 487 #endregion 488 489 #region Instance Properties 490 #endregion 491 492 #region Type-level Functions 493 public static Maybe<NonZeroSbyte> New(sbyte val) => val == 0 ? Maybe<NonZeroSbyte>.None() : new(new(val)); 494 public static NonZeroSbyte NewUnsafe(sbyte val) => new(val); 495 public static Result<NonZeroSbyte, TryFromIntError> TryFrom(sbyte val) => New(val).OKOr(TryFromIntError.OverflowOrUnderflow); 496 #endregion 497 498 #region Instance Functions 499 public readonly NonZeroSbyte Clone() => this; 500 public readonly Ordering Cmp(in NonZeroSbyte other) => Value.CompareTo(other.Value) switch { 501 < 0 => Ordering.Less, 502 0 => Ordering.Equivalent, 503 _ => Ordering.Greater, 504 }; 505 public readonly bool Equals(in NonZeroSbyte other) => Value == other.Value; 506 public override readonly bool Equals(object? _) => false; 507 public override readonly int GetHashCode() => 0; 508 public readonly Unit Hash<THasher>(ref THasher hasher) where THasher: notnull, IHasher => hasher.WriteUnsafe(this); 509 public readonly NonZeroSbyte Into() => this; 510 public readonly sbyte IntoSbyte() => Value; 511 public readonly NonZeroI128 IntoNonZeroI128() => new((I128)Value); 512 readonly NonZeroI128 IInto<NonZeroI128>.Into() => IntoNonZeroI128(); 513 public readonly NonZeroInt IntoNonZeroInt() => new(Value); 514 readonly NonZeroInt IInto<NonZeroInt>.Into() => IntoNonZeroInt(); 515 public readonly NonZeroLong IntoNonZeroLong() => new(Value); 516 readonly NonZeroLong IInto<NonZeroLong>.Into() => IntoNonZeroLong(); 517 public readonly NonZeroShort IntoNonZeroShort() => new(Value); 518 readonly NonZeroShort IInto<NonZeroShort>.Into() => IntoNonZeroShort(); 519 public readonly string IntoString() => ToString(); 520 readonly sbyte IInto<sbyte>.Into() => IntoSbyte(); 521 readonly string IInto<string>.Into() => IntoString(); 522 public readonly Maybe<Ordering> PartialCmp(in NonZeroSbyte other) => new(Cmp(in other)); 523 public override readonly string ToString() => Value.ToString(); 524 readonly Result<NonZeroSbyte, Bottom> ITryInto<NonZeroSbyte, Bottom>.TryInto() => new(this); 525 readonly Result<string, Bottom> ITryInto<string, Bottom>.TryInto() => new(ToString()); 526 readonly Result<sbyte, Bottom> ITryInto<sbyte, Bottom>.TryInto() => new(IntoSbyte()); 527 readonly Result<NonZeroI128, Bottom> ITryInto<NonZeroI128, Bottom>.TryInto() => new(IntoNonZeroI128()); 528 readonly Result<NonZeroInt, Bottom> ITryInto<NonZeroInt, Bottom>.TryInto() => new(IntoNonZeroInt()); 529 readonly Result<NonZeroLong, Bottom> ITryInto<NonZeroLong, Bottom>.TryInto() => new(IntoNonZeroLong()); 530 readonly Result<NonZeroShort, Bottom> ITryInto<NonZeroShort, Bottom>.TryInto() => new(IntoNonZeroShort()); 531 public readonly Result<NonZeroByte, TryIntoIntError> TryIntoNonZeroByte() => Value < 0 ? new(TryIntoIntError.Overflow) : new(new NonZeroByte((byte)Value)); 532 readonly Result<NonZeroByte, TryIntoIntError> ITryInto<NonZeroByte, TryIntoIntError>.TryInto() => TryIntoNonZeroByte(); 533 public readonly Result<NonZeroUshort, TryIntoIntError> TryIntoNonZeroUshort() => Value < 0 ? new(TryIntoIntError.Overflow) : new(new NonZeroUshort((ushort)Value)); 534 readonly Result<NonZeroUshort, TryIntoIntError> ITryInto<NonZeroUshort, TryIntoIntError>.TryInto() => TryIntoNonZeroUshort(); 535 public readonly Result<NonZeroUint, TryIntoIntError> TryIntoNonZeroUint() => Value < 0 ? new(TryIntoIntError.Overflow) : new(new NonZeroUint((uint)Value)); 536 readonly Result<NonZeroUint, TryIntoIntError> ITryInto<NonZeroUint, TryIntoIntError>.TryInto() => TryIntoNonZeroUint(); 537 public readonly Result<NonZeroUlong, TryIntoIntError> TryIntoNonZeroUlong() => Value < 0 ? new(TryIntoIntError.Overflow) : new(new NonZeroUlong((ulong)Value)); 538 readonly Result<NonZeroUlong, TryIntoIntError> ITryInto<NonZeroUlong, TryIntoIntError>.TryInto() => TryIntoNonZeroUlong(); 539 public readonly Result<NonZeroU128, TryIntoIntError> TryIntoNonZeroU128() => Value < 0 ? new(TryIntoIntError.Overflow) : new(new NonZeroU128((U128)Value)); 540 readonly Result<NonZeroU128, TryIntoIntError> ITryInto<NonZeroU128, TryIntoIntError>.TryInto() => TryIntoNonZeroU128(); 541 #endregion 542 543 #region Operators 544 public static bool operator !=(NonZeroSbyte val0, NonZeroSbyte val1) => val0.Value != val1.Value; 545 public static bool operator <(NonZeroSbyte val0, NonZeroSbyte val1) => val0.Value < val1.Value; 546 public static bool operator <=(NonZeroSbyte val0, NonZeroSbyte val1) => val0.Value <= val1.Value; 547 public static bool operator ==(NonZeroSbyte val0, NonZeroSbyte val1) => val0.Value == val1.Value; 548 public static bool operator >(NonZeroSbyte val0, NonZeroSbyte val1) => val0.Value > val1.Value; 549 public static bool operator >=(NonZeroSbyte val0, NonZeroSbyte val1) => val0.Value >= val1.Value; 550 public static NonZeroSbyte operator |(NonZeroSbyte val0, NonZeroSbyte val1) => new((sbyte)(val0.Value | val1.Value)); 551 public static NonZeroSbyte operator |(NonZeroSbyte val0, sbyte val1) => new((sbyte)(val0.Value | val1)); 552 #endregion 553 554 #region Types 555 #endregion 556 } 557 [StructLayout(LayoutKind.Explicit, CharSet = CharSet.Unicode, Pack = 2, Size = 2)] 558 public readonly struct NonZeroShort: IClone<NonZeroShort>, IEquality<NonZeroShort>, IHashable, IInto<NonZeroShort>, IInto<NonZeroI128>, IInto<NonZeroInt>, IInto<NonZeroLong>, IInto<short>, IInto<string>, IOrd<NonZeroShort>, ITryInto<NonZeroByte, TryIntoIntError>, ITryInto<NonZeroSbyte, TryIntoIntError>, ITryInto<NonZeroUshort, TryIntoIntError>, ITryInto<NonZeroUint, TryIntoIntError>, ITryInto<NonZeroUlong, TryIntoIntError>, ITryInto<NonZeroU128, TryIntoIntError>, ITryFrom<NonZeroShort, short, TryFromIntError> { 559 560 #region Type-level Constructors 561 #endregion 562 563 #region Instance Constructors 564 public NonZeroShort() => throw new InvalidOperationException("Parameterless constructor is not allowed to be called!"); 565 internal NonZeroShort(short val) => Value = val; 566 #endregion 567 568 #region Type-level Fields 569 #endregion 570 571 #region Instance Fields 572 [FieldOffset(0)] public readonly short Value; 573 #endregion 574 575 #region Type-level Properties 576 #endregion 577 578 #region Instance Properties 579 #endregion 580 581 #region Type-level Functions 582 public static Maybe<NonZeroShort> New(short val) => val == 0 ? Maybe<NonZeroShort>.None() : new(new(val)); 583 public static NonZeroShort NewUnsafe(short val) => new(val); 584 public static Result<NonZeroShort, TryFromIntError> TryFrom(short val) => New(val).OKOr(TryFromIntError.OverflowOrUnderflow); 585 #endregion 586 587 #region Instance Functions 588 public readonly NonZeroShort Clone() => this; 589 public readonly Ordering Cmp(in NonZeroShort other) => Value.CompareTo(other.Value) switch { 590 < 0 => Ordering.Less, 591 0 => Ordering.Equivalent, 592 _ => Ordering.Greater, 593 }; 594 public readonly bool Equals(in NonZeroShort other) => Value == other.Value; 595 public override readonly bool Equals(object? _) => false; 596 public override readonly int GetHashCode() => 0; 597 public readonly Unit Hash<THasher>(ref THasher hasher) where THasher: notnull, IHasher => hasher.WriteUnsafe(this); 598 public readonly NonZeroShort Into() => this; 599 public readonly short IntoShort() => Value; 600 public readonly NonZeroI128 IntoNonZeroI128() => new((I128)Value); 601 readonly NonZeroI128 IInto<NonZeroI128>.Into() => IntoNonZeroI128(); 602 public readonly NonZeroInt IntoNonZeroInt() => new(Value); 603 readonly NonZeroInt IInto<NonZeroInt>.Into() => IntoNonZeroInt(); 604 public readonly NonZeroLong IntoNonZeroLong() => new(Value); 605 readonly NonZeroLong IInto<NonZeroLong>.Into() => IntoNonZeroLong(); 606 readonly NonZeroShort IInto<NonZeroShort>.Into() => Into(); 607 public readonly string IntoString() => ToString(); 608 readonly short IInto<short>.Into() => IntoShort(); 609 readonly string IInto<string>.Into() => IntoString(); 610 public readonly Maybe<Ordering> PartialCmp(in NonZeroShort other) => new(Cmp(in other)); 611 public override readonly string ToString() => Value.ToString(); 612 readonly Result<NonZeroShort, Bottom> ITryInto<NonZeroShort, Bottom>.TryInto() => new(this); 613 readonly Result<string, Bottom> ITryInto<string, Bottom>.TryInto() => new(ToString()); 614 readonly Result<short, Bottom> ITryInto<short, Bottom>.TryInto() => new(IntoShort()); 615 readonly Result<NonZeroI128, Bottom> ITryInto<NonZeroI128, Bottom>.TryInto() => new(IntoNonZeroI128()); 616 readonly Result<NonZeroInt, Bottom> ITryInto<NonZeroInt, Bottom>.TryInto() => new(IntoNonZeroInt()); 617 readonly Result<NonZeroLong, Bottom> ITryInto<NonZeroLong, Bottom>.TryInto() => new(IntoNonZeroLong()); 618 public readonly Result<NonZeroByte, TryIntoIntError> TryIntoNonZeroByte() => Value < 0 ? new(TryIntoIntError.Overflow) : new(new NonZeroByte((byte)Value)); 619 readonly Result<NonZeroByte, TryIntoIntError> ITryInto<NonZeroByte, TryIntoIntError>.TryInto() => TryIntoNonZeroByte(); 620 public readonly Result<NonZeroSbyte, TryIntoIntError> TryIntoNonZeroSbyte() => Value is > sbyte.MaxValue or < sbyte.MinValue ? new(TryIntoIntError.Overflow) : new(new NonZeroSbyte((sbyte)Value)); 621 readonly Result<NonZeroSbyte, TryIntoIntError> ITryInto<NonZeroSbyte, TryIntoIntError>.TryInto() => TryIntoNonZeroSbyte(); 622 public readonly Result<NonZeroUshort, TryIntoIntError> TryIntoNonZeroUshort() => Value < 0 ? new(TryIntoIntError.Overflow) : new(new NonZeroUshort((ushort)Value)); 623 readonly Result<NonZeroUshort, TryIntoIntError> ITryInto<NonZeroUshort, TryIntoIntError>.TryInto() => TryIntoNonZeroUshort(); 624 public readonly Result<NonZeroUint, TryIntoIntError> TryIntoNonZeroUint() => Value < 0 ? new(TryIntoIntError.Overflow) : new(new NonZeroUint((uint)Value)); 625 readonly Result<NonZeroUint, TryIntoIntError> ITryInto<NonZeroUint, TryIntoIntError>.TryInto() => TryIntoNonZeroUint(); 626 public readonly Result<NonZeroUlong, TryIntoIntError> TryIntoNonZeroUlong() => Value < 0 ? new(TryIntoIntError.Overflow) : new(new NonZeroUlong((ulong)Value)); 627 readonly Result<NonZeroUlong, TryIntoIntError> ITryInto<NonZeroUlong, TryIntoIntError>.TryInto() => TryIntoNonZeroUlong(); 628 public readonly Result<NonZeroU128, TryIntoIntError> TryIntoNonZeroU128() => Value < 0 ? new(TryIntoIntError.Overflow) : new(new NonZeroU128((U128)Value)); 629 readonly Result<NonZeroU128, TryIntoIntError> ITryInto<NonZeroU128, TryIntoIntError>.TryInto() => TryIntoNonZeroU128(); 630 #endregion 631 632 #region Operators 633 public static bool operator !=(NonZeroShort val0, NonZeroShort val1) => val0.Value != val1.Value; 634 public static bool operator <(NonZeroShort val0, NonZeroShort val1) => val0.Value < val1.Value; 635 public static bool operator <=(NonZeroShort val0, NonZeroShort val1) => val0.Value <= val1.Value; 636 public static bool operator ==(NonZeroShort val0, NonZeroShort val1) => val0.Value == val1.Value; 637 public static bool operator >(NonZeroShort val0, NonZeroShort val1) => val0.Value > val1.Value; 638 public static bool operator >=(NonZeroShort val0, NonZeroShort val1) => val0.Value >= val1.Value; 639 public static NonZeroShort operator |(NonZeroShort val0, NonZeroShort val1) => new((short)(val0.Value | val1.Value)); 640 public static NonZeroShort operator |(NonZeroShort val0, short val1) => new((short)(val0.Value | val1)); 641 #endregion 642 643 #region Types 644 #endregion 645 } 646 [StructLayout(LayoutKind.Explicit, CharSet = CharSet.Unicode, Pack = 4, Size = 4)] 647 public readonly struct NonZeroInt: IClone<NonZeroInt>, IEquality<NonZeroInt>, IHashable, IInto<NonZeroInt>, IInto<NonZeroI128>, IInto<NonZeroLong>, IInto<int>, IInto<string>, IOrd<NonZeroInt>, ITryInto<NonZeroByte, TryIntoIntError>, ITryInto<NonZeroSbyte, TryIntoIntError>, ITryInto<NonZeroUshort, TryIntoIntError>, ITryInto<NonZeroShort, TryIntoIntError>, ITryInto<NonZeroUint, TryIntoIntError>, ITryInto<NonZeroUlong, TryIntoIntError>, ITryInto<NonZeroU128, TryIntoIntError>, ITryFrom<NonZeroInt, int, TryFromIntError> { 648 649 #region Type-level Constructors 650 #endregion 651 652 #region Instance Constructors 653 public NonZeroInt() => throw new InvalidOperationException("Parameterless constructor is not allowed to be called!"); 654 internal NonZeroInt(int val) => Value = val; 655 #endregion 656 657 #region Type-level Fields 658 #endregion 659 660 #region Instance Fields 661 [FieldOffset(0)] public readonly int Value; 662 #endregion 663 664 #region Type-level Properties 665 #endregion 666 667 #region Instance Properties 668 #endregion 669 670 #region Type-level Functions 671 public static Maybe<NonZeroInt> New(int val) => val == 0 ? Maybe<NonZeroInt>.None() : new(new(val)); 672 public static NonZeroInt NewUnsafe(int val) => new(val); 673 public static Result<NonZeroInt, TryFromIntError> TryFrom(int val) => New(val).OKOr(TryFromIntError.OverflowOrUnderflow); 674 #endregion 675 676 #region Instance Functions 677 public readonly NonZeroInt Clone() => this; 678 public readonly Ordering Cmp(in NonZeroInt other) => Value.CompareTo(other.Value) switch { 679 < 0 => Ordering.Less, 680 0 => Ordering.Equivalent, 681 _ => Ordering.Greater, 682 }; 683 public readonly bool Equals(in NonZeroInt other) => Value == other.Value; 684 public override readonly bool Equals(object? _) => false; 685 public override readonly int GetHashCode() => 0; 686 public readonly Unit Hash<THasher>(ref THasher hasher) where THasher: notnull, IHasher => hasher.WriteUnsafe(this); 687 public readonly NonZeroInt Into() => this; 688 public readonly int IntoInt() => Value; 689 public readonly NonZeroI128 IntoNonZeroI128() => new((I128)Value); 690 readonly NonZeroI128 IInto<NonZeroI128>.Into() => IntoNonZeroI128(); 691 readonly NonZeroInt IInto<NonZeroInt>.Into() => Into(); 692 public readonly NonZeroLong IntoNonZeroLong() => new(Value); 693 readonly NonZeroLong IInto<NonZeroLong>.Into() => IntoNonZeroLong(); 694 public readonly string IntoString() => ToString(); 695 readonly int IInto<int>.Into() => IntoInt(); 696 readonly string IInto<string>.Into() => IntoString(); 697 public readonly Maybe<Ordering> PartialCmp(in NonZeroInt other) => new(Cmp(in other)); 698 public override readonly string ToString() => Value.ToString(); 699 readonly Result<NonZeroInt, Bottom> ITryInto<NonZeroInt, Bottom>.TryInto() => new(this); 700 readonly Result<string, Bottom> ITryInto<string, Bottom>.TryInto() => new(ToString()); 701 readonly Result<int, Bottom> ITryInto<int, Bottom>.TryInto() => new(IntoInt()); 702 readonly Result<NonZeroI128, Bottom> ITryInto<NonZeroI128, Bottom>.TryInto() => new(IntoNonZeroI128()); 703 readonly Result<NonZeroLong, Bottom> ITryInto<NonZeroLong, Bottom>.TryInto() => new(IntoNonZeroLong()); 704 public readonly Result<NonZeroByte, TryIntoIntError> TryIntoNonZeroByte() => Value < 0 ? new(TryIntoIntError.Overflow) : new(new NonZeroByte((byte)Value)); 705 readonly Result<NonZeroByte, TryIntoIntError> ITryInto<NonZeroByte, TryIntoIntError>.TryInto() => TryIntoNonZeroByte(); 706 public readonly Result<NonZeroSbyte, TryIntoIntError> TryIntoNonZeroSbyte() => Value is > sbyte.MaxValue or < sbyte.MinValue ? new(TryIntoIntError.Overflow) : new(new NonZeroSbyte((sbyte)Value)); 707 readonly Result<NonZeroSbyte, TryIntoIntError> ITryInto<NonZeroSbyte, TryIntoIntError>.TryInto() => TryIntoNonZeroSbyte(); 708 public readonly Result<NonZeroUshort, TryIntoIntError> TryIntoNonZeroUshort() => Value < 0 ? new(TryIntoIntError.Overflow) : new(new NonZeroUshort((ushort)Value)); 709 readonly Result<NonZeroUshort, TryIntoIntError> ITryInto<NonZeroUshort, TryIntoIntError>.TryInto() => TryIntoNonZeroUshort(); 710 public readonly Result<NonZeroShort, TryIntoIntError> TryIntoNonZeroShort() => Value is > short.MaxValue or < short.MinValue ? new(TryIntoIntError.Overflow) : new(new NonZeroShort((short)Value)); 711 readonly Result<NonZeroShort, TryIntoIntError> ITryInto<NonZeroShort, TryIntoIntError>.TryInto() => TryIntoNonZeroShort(); 712 public readonly Result<NonZeroUint, TryIntoIntError> TryIntoNonZeroUint() => Value < 0 ? new(TryIntoIntError.Overflow) : new(new NonZeroUint((uint)Value)); 713 readonly Result<NonZeroUint, TryIntoIntError> ITryInto<NonZeroUint, TryIntoIntError>.TryInto() => TryIntoNonZeroUint(); 714 public readonly Result<NonZeroUlong, TryIntoIntError> TryIntoNonZeroUlong() => Value < 0 ? new(TryIntoIntError.Overflow) : new(new NonZeroUlong((ulong)Value)); 715 readonly Result<NonZeroUlong, TryIntoIntError> ITryInto<NonZeroUlong, TryIntoIntError>.TryInto() => TryIntoNonZeroUlong(); 716 public readonly Result<NonZeroU128, TryIntoIntError> TryIntoNonZeroU128() => Value < 0 ? new(TryIntoIntError.Overflow) : new(new NonZeroU128((U128)Value)); 717 readonly Result<NonZeroU128, TryIntoIntError> ITryInto<NonZeroU128, TryIntoIntError>.TryInto() => TryIntoNonZeroU128(); 718 #endregion 719 720 #region Operators 721 public static bool operator !=(NonZeroInt val0, NonZeroInt val1) => val0.Value != val1.Value; 722 public static bool operator <(NonZeroInt val0, NonZeroInt val1) => val0.Value < val1.Value; 723 public static bool operator <=(NonZeroInt val0, NonZeroInt val1) => val0.Value <= val1.Value; 724 public static bool operator ==(NonZeroInt val0, NonZeroInt val1) => val0.Value == val1.Value; 725 public static bool operator >(NonZeroInt val0, NonZeroInt val1) => val0.Value > val1.Value; 726 public static bool operator >=(NonZeroInt val0, NonZeroInt val1) => val0.Value >= val1.Value; 727 public static NonZeroInt operator |(NonZeroInt val0, NonZeroInt val1) => new(val0.Value | val1.Value); 728 public static NonZeroInt operator |(NonZeroInt val0, int val1) => new(val0.Value | val1); 729 #endregion 730 731 #region Types 732 #endregion 733 } 734 [StructLayout(LayoutKind.Explicit, CharSet = CharSet.Unicode, Pack = 8, Size = 8)] 735 public readonly struct NonZeroLong: IClone<NonZeroLong>, IEquality<NonZeroLong>, IHashable, IInto<NonZeroLong>, IInto<NonZeroI128>, IInto<long>, IInto<string>, IOrd<NonZeroLong>, ITryInto<NonZeroByte, TryIntoIntError>, ITryInto<NonZeroSbyte, TryIntoIntError>, ITryInto<NonZeroUshort, TryIntoIntError>, ITryInto<NonZeroShort, TryIntoIntError>, ITryInto<NonZeroInt, TryIntoIntError>, ITryInto<NonZeroUint, TryIntoIntError>, ITryInto<NonZeroUlong, TryIntoIntError>, ITryInto<NonZeroU128, TryIntoIntError>, ITryFrom<NonZeroLong, long, TryFromIntError> { 736 737 #region Type-level Constructors 738 #endregion 739 740 #region Instance Constructors 741 public NonZeroLong() => throw new InvalidOperationException("Parameterless constructor is not allowed to be called!"); 742 internal NonZeroLong(long val) => Value = val; 743 #endregion 744 745 #region Type-level Fields 746 #endregion 747 748 #region Instance Fields 749 [FieldOffset(0)] public readonly long Value; 750 #endregion 751 752 #region Type-level Properties 753 #endregion 754 755 #region Instance Properties 756 #endregion 757 758 #region Type-level Functions 759 public static Maybe<NonZeroLong> New(long val) => val == 0 ? Maybe<NonZeroLong>.None() : new(new(val)); 760 public static NonZeroLong NewUnsafe(long val) => new(val); 761 public static Result<NonZeroLong, TryFromIntError> TryFrom(long val) => New(val).OKOr(TryFromIntError.OverflowOrUnderflow); 762 #endregion 763 764 #region Instance Functions 765 public readonly NonZeroLong Clone() => this; 766 public readonly Ordering Cmp(in NonZeroLong other) => Value.CompareTo(other.Value) switch { 767 < 0 => Ordering.Less, 768 0 => Ordering.Equivalent, 769 _ => Ordering.Greater, 770 }; 771 public readonly bool Equals(in NonZeroLong other) => Value == other.Value; 772 public override readonly bool Equals(object? _) => false; 773 public override readonly int GetHashCode() => 0; 774 public readonly Unit Hash<THasher>(ref THasher hasher) where THasher: notnull, IHasher => hasher.WriteUnsafe(this); 775 public readonly NonZeroLong Into() => this; 776 public readonly long IntoLong() => Value; 777 public readonly NonZeroI128 IntoNonZeroI128() => new((I128)Value); 778 readonly NonZeroI128 IInto<NonZeroI128>.Into() => IntoNonZeroI128(); 779 readonly NonZeroLong IInto<NonZeroLong>.Into() => Into(); 780 public readonly string IntoString() => ToString(); 781 readonly long IInto<long>.Into() => IntoLong(); 782 readonly string IInto<string>.Into() => IntoString(); 783 public readonly Maybe<Ordering> PartialCmp(in NonZeroLong other) => new(Cmp(in other)); 784 public override readonly string ToString() => Value.ToString(); 785 readonly Result<NonZeroLong, Bottom> ITryInto<NonZeroLong, Bottom>.TryInto() => new(this); 786 readonly Result<long, Bottom> ITryInto<long, Bottom>.TryInto() => new(IntoLong()); 787 readonly Result<string, Bottom> ITryInto<string, Bottom>.TryInto() => new(ToString()); 788 readonly Result<NonZeroI128, Bottom> ITryInto<NonZeroI128, Bottom>.TryInto() => new(IntoNonZeroI128()); 789 public readonly Result<NonZeroByte, TryIntoIntError> TryIntoNonZeroByte() => Value < 0 ? new(TryIntoIntError.Overflow) : new(new NonZeroByte((byte)Value)); 790 readonly Result<NonZeroByte, TryIntoIntError> ITryInto<NonZeroByte, TryIntoIntError>.TryInto() => TryIntoNonZeroByte(); 791 public readonly Result<NonZeroSbyte, TryIntoIntError> TryIntoNonZeroSbyte() => Value is > sbyte.MaxValue or < sbyte.MinValue ? new(TryIntoIntError.Overflow) : new(new NonZeroSbyte((sbyte)Value)); 792 readonly Result<NonZeroSbyte, TryIntoIntError> ITryInto<NonZeroSbyte, TryIntoIntError>.TryInto() => TryIntoNonZeroSbyte(); 793 public readonly Result<NonZeroUshort, TryIntoIntError> TryIntoNonZeroUshort() => Value < 0 ? new(TryIntoIntError.Overflow) : new(new NonZeroUshort((ushort)Value)); 794 readonly Result<NonZeroUshort, TryIntoIntError> ITryInto<NonZeroUshort, TryIntoIntError>.TryInto() => TryIntoNonZeroUshort(); 795 public readonly Result<NonZeroShort, TryIntoIntError> TryIntoNonZeroShort() => Value is > short.MaxValue or < short.MinValue ? new(TryIntoIntError.Overflow) : new(new NonZeroShort((short)Value)); 796 readonly Result<NonZeroShort, TryIntoIntError> ITryInto<NonZeroShort, TryIntoIntError>.TryInto() => TryIntoNonZeroShort(); 797 public readonly Result<NonZeroInt, TryIntoIntError> TryIntoNonZeroInt() => Value is > int.MaxValue or < int.MinValue ? new(TryIntoIntError.Overflow) : new(new NonZeroInt((int)Value)); 798 readonly Result<NonZeroInt, TryIntoIntError> ITryInto<NonZeroInt, TryIntoIntError>.TryInto() => TryIntoNonZeroInt(); 799 public readonly Result<NonZeroUint, TryIntoIntError> TryIntoNonZeroUint() => Value < 0 ? new(TryIntoIntError.Overflow) : new(new NonZeroUint((uint)Value)); 800 readonly Result<NonZeroUint, TryIntoIntError> ITryInto<NonZeroUint, TryIntoIntError>.TryInto() => TryIntoNonZeroUint(); 801 public readonly Result<NonZeroUlong, TryIntoIntError> TryIntoNonZeroUlong() => Value < 0 ? new(TryIntoIntError.Overflow) : new(new NonZeroUlong((ulong)Value)); 802 readonly Result<NonZeroUlong, TryIntoIntError> ITryInto<NonZeroUlong, TryIntoIntError>.TryInto() => TryIntoNonZeroUlong(); 803 public readonly Result<NonZeroU128, TryIntoIntError> TryIntoNonZeroU128() => Value < 0 ? new(TryIntoIntError.Overflow) : new(new NonZeroU128((U128)Value)); 804 readonly Result<NonZeroU128, TryIntoIntError> ITryInto<NonZeroU128, TryIntoIntError>.TryInto() => TryIntoNonZeroU128(); 805 #endregion 806 807 #region Operators 808 public static bool operator !=(NonZeroLong val0, NonZeroLong val1) => val0.Value != val1.Value; 809 public static bool operator <(NonZeroLong val0, NonZeroLong val1) => val0.Value < val1.Value; 810 public static bool operator <=(NonZeroLong val0, NonZeroLong val1) => val0.Value <= val1.Value; 811 public static bool operator ==(NonZeroLong val0, NonZeroLong val1) => val0.Value == val1.Value; 812 public static bool operator >(NonZeroLong val0, NonZeroLong val1) => val0.Value > val1.Value; 813 public static bool operator >=(NonZeroLong val0, NonZeroLong val1) => val0.Value >= val1.Value; 814 public static NonZeroLong operator |(NonZeroLong val0, NonZeroLong val1) => new(val0.Value | val1.Value); 815 public static NonZeroLong operator |(NonZeroLong val0, long val1) => new(val0.Value | val1); 816 #endregion 817 818 #region Types 819 #endregion 820 } 821 [StructLayout(LayoutKind.Explicit, CharSet = CharSet.Unicode, Pack = 8, Size = 16)] 822 public readonly struct NonZeroI128: IClone<NonZeroI128>, IEquality<NonZeroI128>, IHashable, IInto<NonZeroI128>, IInto<I128>, IInto<string>, IOrd<NonZeroI128>, ITryInto<NonZeroByte, TryIntoIntError>, ITryInto<NonZeroSbyte, TryIntoIntError>, ITryInto<NonZeroUshort, TryIntoIntError>, ITryInto<NonZeroShort, TryIntoIntError>, ITryInto<NonZeroInt, TryIntoIntError>, ITryInto<NonZeroUint, TryIntoIntError>, ITryInto<NonZeroUlong, TryIntoIntError>, ITryInto<NonZeroLong, TryIntoIntError>, ITryInto<NonZeroU128, TryIntoIntError> { 823 824 #region Type-level Constructors 825 #endregion 826 827 #region Instance Constructors 828 public NonZeroI128() => throw new InvalidOperationException("Parameterless constructor is not allowed to be called!"); 829 internal NonZeroI128(I128 val) => Value = val; 830 #endregion 831 832 #region Type-level Fields 833 #endregion 834 835 #region Instance Fields 836 [FieldOffset(0)] public readonly I128 Value; 837 #endregion 838 839 #region Type-level Properties 840 #endregion 841 842 #region Instance Properties 843 #endregion 844 845 #region Type-level Functions 846 public static Maybe<NonZeroI128> New(I128 val) => val == I128.Zero ? Maybe<NonZeroI128>.None() : new(new(val)); 847 public static NonZeroI128 NewUnsafe(I128 val) => new(val); 848 #endregion 849 850 #region Instance Functions 851 public readonly NonZeroI128 Clone() => this; 852 public readonly Ordering Cmp(in NonZeroI128 other) => Value.Cmp(in other.Value); 853 public readonly bool Equals(in NonZeroI128 other) => Value == other.Value; 854 public override readonly bool Equals(object? _) => false; 855 public override readonly int GetHashCode() => 0; 856 public readonly Unit Hash<THasher>(ref THasher hasher) where THasher: notnull, IHasher => hasher.WriteUnsafe(this); 857 public readonly NonZeroI128 Into() => this; 858 public readonly I128 IntoI128() => Value; 859 readonly NonZeroI128 IInto<NonZeroI128>.Into() => Into(); 860 public readonly string IntoString() => ToString(); 861 readonly I128 IInto<I128>.Into() => IntoI128(); 862 readonly string IInto<string>.Into() => IntoString(); 863 public readonly Maybe<Ordering> PartialCmp(in NonZeroI128 other) => new(Cmp(in other)); 864 public override readonly string ToString() => Value.ToString(); 865 readonly Result<NonZeroI128, Bottom> ITryInto<NonZeroI128, Bottom>.TryInto() => new(this); 866 readonly Result<I128, Bottom> ITryInto<I128, Bottom>.TryInto() => new(IntoI128()); 867 readonly Result<string, Bottom> ITryInto<string, Bottom>.TryInto() => new(ToString()); 868 public readonly Result<NonZeroByte, TryIntoIntError> TryIntoNonZeroByte() => Value < I128.Zero ? new(TryIntoIntError.Overflow) : new(new NonZeroByte((byte)Value)); 869 readonly Result<NonZeroByte, TryIntoIntError> ITryInto<NonZeroByte, TryIntoIntError>.TryInto() => TryIntoNonZeroByte(); 870 public readonly Result<NonZeroSbyte, TryIntoIntError> TryIntoNonZeroSbyte() => Value > (I128)sbyte.MaxValue || Value < (I128)sbyte.MinValue ? new(TryIntoIntError.Overflow) : new(new NonZeroSbyte((sbyte)Value)); 871 readonly Result<NonZeroSbyte, TryIntoIntError> ITryInto<NonZeroSbyte, TryIntoIntError>.TryInto() => TryIntoNonZeroSbyte(); 872 public readonly Result<NonZeroUshort, TryIntoIntError> TryIntoNonZeroUshort() => Value < I128.Zero ? new(TryIntoIntError.Overflow) : new(new NonZeroUshort((ushort)Value)); 873 readonly Result<NonZeroUshort, TryIntoIntError> ITryInto<NonZeroUshort, TryIntoIntError>.TryInto() => TryIntoNonZeroUshort(); 874 public readonly Result<NonZeroShort, TryIntoIntError> TryIntoNonZeroShort() => Value > (I128)short.MaxValue || Value < (I128)short.MinValue ? new(TryIntoIntError.Overflow) : new(new NonZeroShort((short)Value)); 875 readonly Result<NonZeroShort, TryIntoIntError> ITryInto<NonZeroShort, TryIntoIntError>.TryInto() => TryIntoNonZeroShort(); 876 public readonly Result<NonZeroInt, TryIntoIntError> TryIntoNonZeroInt() => Value > (I128)int.MaxValue || Value < (I128)int.MinValue ? new(TryIntoIntError.Overflow) : new(new NonZeroInt((int)Value)); 877 readonly Result<NonZeroInt, TryIntoIntError> ITryInto<NonZeroInt, TryIntoIntError>.TryInto() => TryIntoNonZeroInt(); 878 public readonly Result<NonZeroLong, TryIntoIntError> TryIntoNonZeroLong() => Value > (I128)long.MaxValue || Value < (I128)long.MinValue ? new(TryIntoIntError.Overflow) : new(new NonZeroLong((long)Value)); 879 readonly Result<NonZeroLong, TryIntoIntError> ITryInto<NonZeroLong, TryIntoIntError>.TryInto() => TryIntoNonZeroLong(); 880 public readonly Result<NonZeroUint, TryIntoIntError> TryIntoNonZeroUint() => Value < I128.Zero ? new(TryIntoIntError.Overflow) : new(new NonZeroUint((uint)Value)); 881 readonly Result<NonZeroUint, TryIntoIntError> ITryInto<NonZeroUint, TryIntoIntError>.TryInto() => TryIntoNonZeroUint(); 882 public readonly Result<NonZeroUlong, TryIntoIntError> TryIntoNonZeroUlong() => Value < I128.Zero ? new(TryIntoIntError.Overflow) : new(new NonZeroUlong((ulong)Value)); 883 readonly Result<NonZeroUlong, TryIntoIntError> ITryInto<NonZeroUlong, TryIntoIntError>.TryInto() => TryIntoNonZeroUlong(); 884 public readonly Result<NonZeroU128, TryIntoIntError> TryIntoNonZeroU128() => Value < I128.Zero ? new(TryIntoIntError.Overflow) : new(new NonZeroU128((U128)Value)); 885 readonly Result<NonZeroU128, TryIntoIntError> ITryInto<NonZeroU128, TryIntoIntError>.TryInto() => TryIntoNonZeroU128(); 886 #endregion 887 888 #region Operators 889 public static bool operator !=(NonZeroI128 val0, NonZeroI128 val1) => val0.Value != val1.Value; 890 public static bool operator <(NonZeroI128 val0, NonZeroI128 val1) => val0.Value < val1.Value; 891 public static bool operator <=(NonZeroI128 val0, NonZeroI128 val1) => val0.Value <= val1.Value; 892 public static bool operator ==(NonZeroI128 val0, NonZeroI128 val1) => val0.Value == val1.Value; 893 public static bool operator >(NonZeroI128 val0, NonZeroI128 val1) => val0.Value > val1.Value; 894 public static bool operator >=(NonZeroI128 val0, NonZeroI128 val1) => val0.Value >= val1.Value; 895 public static NonZeroI128 operator |(NonZeroI128 val0, NonZeroI128 val1) => new(val0.Value | val1.Value); 896 public static NonZeroI128 operator |(NonZeroI128 val0, I128 val1) => new(val0.Value | val1); 897 #endregion 898 899 #region Types 900 #endregion 901 } 902 #endregion 903 904 #region Namespaces 905 #endregion 906 } 907 #endregion