Wrappers.cs (30622B)
1 using Std.Clone; 2 using Std.Cmp; 3 using static Std.Cmp.Ordering; 4 using Std.Convert; 5 using Std.Hashing; 6 using Std.Maybe; 7 using static Std.Maybe.Maybe<Std.Cmp.Ordering>; 8 using static Std.Maybe.Maybe<uint>; 9 using Std.Result; 10 using System.Runtime.InteropServices; 11 #pragma warning disable CA1051, CA1066, CA1716, CA1720, CA1815, CA2231, IDE1006 12 #region Namespaces 13 namespace Std.Num { 14 #region Types 15 [StructLayout(LayoutKind.Explicit, CharSet = CharSet.Unicode, Pack = 1, Size = 1)] 16 public struct @byte: IProduct<byte>, IClone<@byte>, IEquality<@byte>, IHashable, IInto<@byte>, IInto<string>, IOrd<@byte> { 17 18 #region Type-level Constructors 19 #endregion 20 21 #region Instance Constructors 22 public @byte() => Value = byte.MinValue; 23 public @byte(byte val) => Value = val; 24 #endregion 25 26 #region Type-level Fields 27 #endregion 28 29 #region Instance Fields 30 [FieldOffset(0)] public byte Value; 31 #endregion 32 33 #region Type-level Properties 34 #endregion 35 36 #region Instance Properties 37 public readonly byte Field0 => Value; 38 #endregion 39 40 #region Type-level Functions 41 #endregion 42 43 #region Instance Functions 44 public readonly @byte Clone() => this; 45 public readonly Ordering Cmp(in @byte other) => Value.CompareTo(other.Value) switch { 46 47 < 0 => Less, 48 > 0 => Greater, 49 0 => Equivalent, 50 }; 51 public readonly void Deconstruct(out byte t0) => t0 = Value; 52 public readonly bool Equals(in @byte other) => this == other; 53 public override readonly bool Equals(object? _) => false; 54 public override readonly int GetHashCode() => 0; 55 public readonly Unit Hash<THasher>(ref THasher hasher) where THasher: notnull, IHasher => hasher.WriteUnsafe(this); 56 public readonly @byte Into() => this; 57 public readonly string IntoString() => ToString(); 58 readonly string IInto<string>.Into() => IntoString(); 59 public readonly Maybe<Ordering> PartialCmp(in @byte other) => Some(Cmp(in other)); 60 public override readonly string ToString() => Value.ToString(); 61 readonly Result<@byte, Bottom> ITryInto<@byte, Bottom>.TryInto() => new(this); 62 readonly Result<string, Bottom> ITryInto<string, Bottom>.TryInto() => new(ToString()); 63 #endregion 64 65 #region Operators 66 public static bool operator !=(@byte val0, @byte val1) => val0.Value != val1.Value; 67 public static bool operator <(@byte val0, @byte val1) => val0.Value < val1.Value; 68 public static bool operator <=(@byte val0, @byte val1) => val0.Value <= val1.Value; 69 public static bool operator ==(@byte val0, @byte val1) => val0.Value == val1.Value; 70 public static bool operator >(@byte val0, @byte val1) => val0.Value > val1.Value; 71 public static bool operator >=(@byte val0, @byte val1) => val0.Value >= val1.Value; 72 public static implicit operator @byte(byte val) => new(val); 73 public static implicit operator byte(@byte val) => val.Value; 74 #endregion 75 76 #region Types 77 #endregion 78 } 79 [StructLayout(LayoutKind.Explicit, CharSet = CharSet.Unicode, Pack = 8, Size = 16)] 80 public struct @decimal: IProduct<decimal>, IClone<@decimal>, IEquality<@decimal>, IHashable, IInto<@decimal>, IInto<string>, IOrd<@decimal> { 81 82 #region Type-level Constructors 83 #endregion 84 85 #region Instance Constructors 86 public @decimal() => Value = decimal.Zero; 87 public @decimal(decimal val) => Value = val; 88 #endregion 89 90 #region Type-level Fields 91 #endregion 92 93 #region Instance Fields 94 [FieldOffset(0)] public decimal Value; 95 #endregion 96 97 #region Type-level Properties 98 #endregion 99 100 #region Instance Properties 101 public readonly decimal Field0 => Value; 102 #endregion 103 104 #region Type-level Functions 105 #endregion 106 107 #region Instance Functions 108 public readonly @decimal Clone() => this; 109 public readonly Ordering Cmp(in @decimal other) => Value.CompareTo(other.Value) switch { 110 < 0 => Less, 111 > 0 => Greater, 112 0 => Equivalent, 113 }; 114 public readonly void Deconstruct(out decimal t0) => t0 = Value; 115 public readonly bool Equals(in @decimal other) => this == other; 116 public override readonly bool Equals(object? _) => false; 117 public override readonly int GetHashCode() => 0; 118 public readonly Unit Hash<THasher>(ref THasher hasher) where THasher: notnull, IHasher => hasher.WriteInt(Value.GetHashCode()); 119 public readonly @decimal Into() => this; 120 public readonly string IntoString() => ToString(); 121 readonly string IInto<string>.Into() => IntoString(); 122 public readonly Maybe<Ordering> PartialCmp(in @decimal other) => Some(Cmp(in other)); 123 public override readonly string ToString() => Value.ToString("G29"); 124 readonly Result<@decimal, Bottom> ITryInto<@decimal, Bottom>.TryInto() => new(this); 125 readonly Result<string, Bottom> ITryInto<string, Bottom>.TryInto() => new(ToString()); 126 #endregion 127 128 #region Operators 129 public static bool operator !=(@decimal val0, @decimal val1) => val0.Value != val1.Value; 130 public static bool operator <(@decimal val0, @decimal val1) => val0.Value < val1.Value; 131 public static bool operator <=(@decimal val0, @decimal val1) => val0.Value <= val1.Value; 132 public static bool operator ==(@decimal val0, @decimal val1) => val0.Value == val1.Value; 133 public static bool operator >(@decimal val0, @decimal val1) => val0.Value > val1.Value; 134 public static bool operator >=(@decimal val0, @decimal val1) => val0.Value >= val1.Value; 135 public static implicit operator @decimal(decimal val) => new(val); 136 public static implicit operator decimal(@decimal val) => val.Value; 137 #endregion 138 139 #region Types 140 #endregion 141 } 142 [StructLayout(LayoutKind.Explicit, CharSet = CharSet.Unicode, Pack = 8, Size = 8)] 143 public struct @double: IProduct<double>, IClone<@double>, IInto<@double>, IInto<string>, IPartialOrd<@double, @double> { 144 145 #region Type-level Constructors 146 #endregion 147 148 #region Instance Constructors 149 public @double() => Value = +0.0d; 150 public @double(double val) => Value = val; 151 #endregion 152 153 #region Type-level Fields 154 #endregion 155 156 #region Instance Fields 157 [FieldOffset(0)] public double Value; 158 #endregion 159 160 #region Type-level Properties 161 #endregion 162 163 #region Instance Properties 164 public readonly double Field0 => Value; 165 #endregion 166 167 #region Type-level Functions 168 #endregion 169 170 #region Instance Functions 171 public readonly @double Clone() => this; 172 public readonly void Deconstruct(out double t0) => t0 = Value; 173 public override readonly bool Equals(object? _) => false; 174 public override readonly int GetHashCode() => 0; 175 public readonly @double Into() => this; 176 public readonly string IntoString() => ToString(); 177 readonly string IInto<string>.Into() => IntoString(); 178 public readonly Maybe<Ordering> PartialCmp(in @double other) => Value < other.Value ? new(Less) : Value == other.Value ? new(Equivalent) : Value > other.Value ? new(Greater) : Maybe<Ordering>.None(); 179 public override readonly string ToString() => Value.ToString("G17"); 180 readonly Result<@double, Bottom> ITryInto<@double, Bottom>.TryInto() => new(this); 181 readonly Result<string, Bottom> ITryInto<string, Bottom>.TryInto() => new(ToString()); 182 #endregion 183 184 #region Operators 185 public static bool operator !=(@double val0, @double val1) => val0.Value != val1.Value; 186 public static bool operator <(@double val0, @double val1) => val0.Value < val1.Value; 187 public static bool operator <=(@double val0, @double val1) => val0.Value <= val1.Value; 188 public static bool operator ==(@double val0, @double val1) => val0.Value == val1.Value; 189 public static bool operator >(@double val0, @double val1) => val0.Value > val1.Value; 190 public static bool operator >=(@double val0, @double val1) => val0.Value >= val1.Value; 191 public static implicit operator @double(double val) => new(val); 192 public static implicit operator double(@double val) => val.Value; 193 #endregion 194 195 #region Types 196 #endregion 197 } 198 [StructLayout(LayoutKind.Explicit, CharSet = CharSet.Unicode, Pack = 4, Size = 4)] 199 public struct @float: IProduct<float>, IClone<@float>, IInto<@float>, IInto<string>, IPartialOrd<@float, @float> { 200 201 #region Type-level Constructors 202 #endregion 203 204 #region Instance Constructors 205 public @float() => Value = +0.0f; 206 public @float(float val) => Value = val; 207 #endregion 208 209 #region Type-level Fields 210 #endregion 211 212 #region Instance Fields 213 [FieldOffset(0)] public float Value; 214 #endregion 215 216 #region Type-level Properties 217 #endregion 218 219 #region Instance Properties 220 public readonly float Field0 => Value; 221 #endregion 222 223 #region Type-level Functions 224 #endregion 225 226 #region Instance Functions 227 public readonly @float Clone() => this; 228 public readonly void Deconstruct(out float t0) => t0 = Value; 229 public override readonly bool Equals(object? _) => false; 230 public override readonly int GetHashCode() => 0; 231 public readonly @float Into() => this; 232 public readonly string IntoString() => ToString(); 233 readonly string IInto<string>.Into() => IntoString(); 234 public readonly Maybe<Ordering> PartialCmp(in @float other) => Value < other.Value ? new(Less) : Value == other.Value ? new(Equivalent) : Value > other.Value ? new(Greater) : Maybe<Ordering>.None(); 235 public override readonly string ToString() => Value.ToString("G9"); 236 readonly Result<@float, Bottom> ITryInto<@float, Bottom>.TryInto() => new(this); 237 readonly Result<string, Bottom> ITryInto<string, Bottom>.TryInto() => new(ToString()); 238 #endregion 239 240 #region Operators 241 public static bool operator !=(@float val0, @float val1) => val0.Value != val1.Value; 242 public static bool operator <(@float val0, @float val1) => val0.Value < val1.Value; 243 public static bool operator <=(@float val0, @float val1) => val0.Value <= val1.Value; 244 public static bool operator ==(@float val0, @float val1) => val0.Value == val1.Value; 245 public static bool operator >(@float val0, @float val1) => val0.Value > val1.Value; 246 public static bool operator >=(@float val0, @float val1) => val0.Value >= val1.Value; 247 public static implicit operator @float(float val) => new(val); 248 public static implicit operator float(@float val) => val.Value; 249 #endregion 250 251 #region Types 252 #endregion 253 } 254 [StructLayout(LayoutKind.Explicit, CharSet = CharSet.Unicode, Pack = 4, Size = 4)] 255 public struct @int: IProduct<int>, IClone<@int>, IEquality<@int>, IHashable, IInto<@int>, IInto<string>, IOrd<@int> { 256 257 #region Type-level Constructors 258 #endregion 259 260 #region Instance Constructors 261 public @int() => Value = 0; 262 public @int(int val) => Value = val; 263 #endregion 264 265 #region Type-level Fields 266 #endregion 267 268 #region Instance Fields 269 [FieldOffset(0)] public int Value; 270 #endregion 271 272 #region Type-level Properties 273 #endregion 274 275 #region Instance Properties 276 public readonly int Field0 => Value; 277 #endregion 278 279 #region Type-level Functions 280 #endregion 281 282 #region Instance Functions 283 public readonly @int Clone() => this; 284 public readonly Ordering Cmp(in @int other) => Value.CompareTo(other.Value) switch { 285 286 < 0 => Less, 287 > 0 => Greater, 288 0 => Equivalent, 289 }; 290 public readonly void Deconstruct(out int t0) => t0 = Value; 291 public readonly bool Equals(in @int other) => this == other; 292 public override readonly bool Equals(object? _) => false; 293 public override readonly int GetHashCode() => 0; 294 public readonly Unit Hash<THasher>(ref THasher hasher) where THasher: notnull, IHasher => hasher.WriteUnsafe(this); 295 public readonly @int Into() => this; 296 public readonly string IntoString() => ToString(); 297 readonly string IInto<string>.Into() => IntoString(); 298 public readonly Maybe<Ordering> PartialCmp(in @int other) => Some(Cmp(in other)); 299 public override readonly string ToString() => Value.ToString(); 300 readonly Result<@int, Bottom> ITryInto<@int, Bottom>.TryInto() => new(this); 301 readonly Result<string, Bottom> ITryInto<string, Bottom>.TryInto() => new(ToString()); 302 #endregion 303 304 #region Operators 305 public static bool operator !=(@int val0, @int val1) => val0.Value != val1.Value; 306 public static bool operator <(@int val0, @int val1) => val0.Value < val1.Value; 307 public static bool operator <=(@int val0, @int val1) => val0.Value <= val1.Value; 308 public static bool operator ==(@int val0, @int val1) => val0.Value == val1.Value; 309 public static bool operator >(@int val0, @int val1) => val0.Value > val1.Value; 310 public static bool operator >=(@int val0, @int val1) => val0.Value >= val1.Value; 311 public static implicit operator @int(int val) => new(val); 312 public static implicit operator int(@int val) => val.Value; 313 #endregion 314 315 #region Types 316 #endregion 317 } 318 [StructLayout(LayoutKind.Explicit, CharSet = CharSet.Unicode, Pack = 8, Size = 8)] 319 public struct @long: IProduct<long>, IClone<@long>, IEquality<@long>, IHashable, IInto<@long>, IInto<string>, IOrd<@long> { 320 321 #region Type-level Constructors 322 #endregion 323 324 #region Instance Constructors 325 public @long() => Value = 0L; 326 public @long(long val) => Value = val; 327 #endregion 328 329 #region Type-level Fields 330 #endregion 331 332 #region Instance Fields 333 [FieldOffset(0)] public long Value; 334 #endregion 335 336 #region Type-level Properties 337 #endregion 338 339 #region Instance Properties 340 public readonly long Field0 => Value; 341 #endregion 342 343 #region Type-level Functions 344 #endregion 345 346 #region Instance Functions 347 public readonly @long Clone() => this; 348 public readonly Ordering Cmp(in @long other) => Value.CompareTo(other.Value) switch { 349 350 < 0 => Less, 351 > 0 => Greater, 352 0 => Equivalent, 353 }; 354 public readonly void Deconstruct(out long t0) => t0 = Value; 355 public readonly bool Equals(in @long other) => this == other; 356 public override readonly bool Equals(object? _) => false; 357 public override readonly int GetHashCode() => 0; 358 public readonly Unit Hash<THasher>(ref THasher hasher) where THasher: notnull, IHasher => hasher.WriteUnsafe(this); 359 public readonly @long Into() => this; 360 public readonly string IntoString() => ToString(); 361 readonly string IInto<string>.Into() => IntoString(); 362 public readonly Maybe<Ordering> PartialCmp(in @long other) => Some(Cmp(in other)); 363 public override readonly string ToString() => Value.ToString(); 364 readonly Result<@long, Bottom> ITryInto<@long, Bottom>.TryInto() => new(this); 365 readonly Result<string, Bottom> ITryInto<string, Bottom>.TryInto() => new(ToString()); 366 #endregion 367 368 #region Operators 369 public static bool operator !=(@long val0, @long val1) => val0.Value != val1.Value; 370 public static bool operator <(@long val0, @long val1) => val0.Value < val1.Value; 371 public static bool operator <=(@long val0, @long val1) => val0.Value <= val1.Value; 372 public static bool operator ==(@long val0, @long val1) => val0.Value == val1.Value; 373 public static bool operator >(@long val0, @long val1) => val0.Value > val1.Value; 374 public static bool operator >=(@long val0, @long val1) => val0.Value >= val1.Value; 375 public static implicit operator @long(long val) => new(val); 376 public static implicit operator long(@long val) => val.Value; 377 #endregion 378 379 #region Types 380 #endregion 381 } 382 [StructLayout(LayoutKind.Explicit, CharSet = CharSet.Unicode, Pack = 1, Size = 1)] 383 public struct @sbyte: IProduct<sbyte>, IClone<@sbyte>, IEquality<@sbyte>, IHashable, IInto<@sbyte>, IInto<string>, IOrd<@sbyte> { 384 385 #region Type-level Constructors 386 #endregion 387 388 #region Instance Constructors 389 public @sbyte() => Value = 0; 390 public @sbyte(sbyte val) => Value = val; 391 #endregion 392 393 #region Type-level Fields 394 #endregion 395 396 #region Instance Fields 397 [FieldOffset(0)] public sbyte Value; 398 #endregion 399 400 #region Type-level Properties 401 #endregion 402 403 #region Instance Properties 404 public readonly sbyte Field0 => Value; 405 #endregion 406 407 #region Type-level Functions 408 #endregion 409 410 #region Instance Functions 411 public readonly @sbyte Clone() => this; 412 public readonly Ordering Cmp(in @sbyte other) => Value.CompareTo(other.Value) switch { 413 414 < 0 => Less, 415 > 0 => Greater, 416 0 => Equivalent, 417 }; 418 public readonly void Deconstruct(out sbyte t0) => t0 = Value; 419 public readonly bool Equals(in @sbyte other) => this == other; 420 public override readonly bool Equals(object? _) => false; 421 public override readonly int GetHashCode() => 0; 422 public readonly Unit Hash<THasher>(ref THasher hasher) where THasher: notnull, IHasher => hasher.WriteUnsafe(this); 423 public readonly @sbyte Into() => this; 424 public readonly string IntoString() => ToString(); 425 readonly string IInto<string>.Into() => IntoString(); 426 public readonly Maybe<Ordering> PartialCmp(in @sbyte other) => Some(Cmp(in other)); 427 public override readonly string ToString() => Value.ToString(); 428 readonly Result<@sbyte, Bottom> ITryInto<@sbyte, Bottom>.TryInto() => new(this); 429 readonly Result<string, Bottom> ITryInto<string, Bottom>.TryInto() => new(ToString()); 430 #endregion 431 432 #region Operators 433 public static bool operator !=(@sbyte val0, @sbyte val1) => val0.Value != val1.Value; 434 public static bool operator <(@sbyte val0, @sbyte val1) => val0.Value < val1.Value; 435 public static bool operator <=(@sbyte val0, @sbyte val1) => val0.Value <= val1.Value; 436 public static bool operator ==(@sbyte val0, @sbyte val1) => val0.Value == val1.Value; 437 public static bool operator >(@sbyte val0, @sbyte val1) => val0.Value > val1.Value; 438 public static bool operator >=(@sbyte val0, @sbyte val1) => val0.Value >= val1.Value; 439 public static implicit operator @sbyte(sbyte val) => new(val); 440 public static implicit operator sbyte(@sbyte val) => val.Value; 441 #endregion 442 443 #region Types 444 #endregion 445 } 446 [StructLayout(LayoutKind.Explicit, CharSet = CharSet.Unicode, Pack = 2, Size = 2)] 447 public struct @short: IProduct<short>, IClone<@short>, IEquality<@short>, IHashable, IInto<@short>, IInto<string>, IOrd<@short> { 448 449 #region Type-level Constructors 450 #endregion 451 452 #region Instance Constructors 453 public @short() => Value = 0; 454 public @short(short val) => Value = val; 455 #endregion 456 457 #region Type-level Fields 458 #endregion 459 460 #region Instance Fields 461 [FieldOffset(0)] public short Value; 462 #endregion 463 464 #region Type-level Properties 465 #endregion 466 467 #region Instance Properties 468 public readonly short Field0 => Value; 469 #endregion 470 471 #region Type-level Functions 472 #endregion 473 474 #region Instance Functions 475 public readonly @short Clone() => this; 476 public readonly Ordering Cmp(in @short other) => Value.CompareTo(other.Value) switch { 477 478 < 0 => Less, 479 > 0 => Greater, 480 0 => Equivalent, 481 }; 482 public readonly void Deconstruct(out short t0) => t0 = Value; 483 public readonly bool Equals(in @short other) => this == other; 484 public override readonly bool Equals(object? _) => false; 485 public override readonly int GetHashCode() => 0; 486 public readonly Unit Hash<THasher>(ref THasher hasher) where THasher: notnull, IHasher => hasher.WriteUnsafe(this); 487 public readonly @short Into() => this; 488 public readonly string IntoString() => ToString(); 489 readonly string IInto<string>.Into() => IntoString(); 490 public readonly Maybe<Ordering> PartialCmp(in @short other) => Some(Cmp(in other)); 491 public override readonly string ToString() => Value.ToString(); 492 readonly Result<@short, Bottom> ITryInto<@short, Bottom>.TryInto() => new(this); 493 readonly Result<string, Bottom> ITryInto<string, Bottom>.TryInto() => new(ToString()); 494 #endregion 495 496 #region Operators 497 public static bool operator !=(@short val0, @short val1) => val0.Value != val1.Value; 498 public static bool operator <(@short val0, @short val1) => val0.Value < val1.Value; 499 public static bool operator <=(@short val0, @short val1) => val0.Value <= val1.Value; 500 public static bool operator ==(@short val0, @short val1) => val0.Value == val1.Value; 501 public static bool operator >(@short val0, @short val1) => val0.Value > val1.Value; 502 public static bool operator >=(@short val0, @short val1) => val0.Value >= val1.Value; 503 public static implicit operator @short(short val) => new(val); 504 public static implicit operator short(@short val) => val.Value; 505 #endregion 506 507 #region Types 508 #endregion 509 } 510 [StructLayout(LayoutKind.Explicit, CharSet = CharSet.Unicode, Pack = 4, Size = 4)] 511 public struct @uint: IProduct<uint>, IClone<@uint>, IEquality<@uint>, IHashable, IInto<@uint>, IInto<string>, IOrd<@uint> { 512 513 #region Type-level Constructors 514 #endregion 515 516 #region Instance Constructors 517 public @uint() => Value = uint.MinValue; 518 public @uint(uint val) => Value = val; 519 #endregion 520 521 #region Type-level Fields 522 #endregion 523 524 #region Instance Fields 525 [FieldOffset(0)] public uint Value; 526 #endregion 527 528 #region Type-level Properties 529 #endregion 530 531 #region Instance Properties 532 public readonly uint Field0 => Value; 533 #endregion 534 535 #region Type-level Functions 536 #endregion 537 538 #region Instance Functions 539 public readonly @uint Clone() => this; 540 public readonly Ordering Cmp(in @uint other) => Value.CompareTo(other.Value) switch { 541 542 < 0 => Less, 543 > 0 => Greater, 544 0 => Equivalent, 545 }; 546 public readonly void Deconstruct(out uint t0) => t0 = Value; 547 public readonly bool Equals(in @uint other) => this == other; 548 public override readonly bool Equals(object? _) => false; 549 public override readonly int GetHashCode() => 0; 550 public readonly Unit Hash<THasher>(ref THasher hasher) where THasher: notnull, IHasher => hasher.WriteUnsafe(this); 551 public readonly @uint Into() => this; 552 public readonly string IntoString() => ToString(); 553 readonly string IInto<string>.Into() => IntoString(); 554 public readonly Maybe<Ordering> PartialCmp(in @uint other) => Some(Cmp(in other)); 555 public override readonly string ToString() => Value.ToString(); 556 readonly Result<@uint, Bottom> ITryInto<@uint, Bottom>.TryInto() => new(this); 557 readonly Result<string, Bottom> ITryInto<string, Bottom>.TryInto() => new(ToString()); 558 #endregion 559 560 #region Operators 561 public static bool operator !=(@uint val0, @uint val1) => val0.Value != val1.Value; 562 public static bool operator <(@uint val0, @uint val1) => val0.Value < val1.Value; 563 public static bool operator <=(@uint val0, @uint val1) => val0.Value <= val1.Value; 564 public static bool operator ==(@uint val0, @uint val1) => val0.Value == val1.Value; 565 public static bool operator >(@uint val0, @uint val1) => val0.Value > val1.Value; 566 public static bool operator >=(@uint val0, @uint val1) => val0.Value >= val1.Value; 567 public static implicit operator @uint(uint val) => new(val); 568 public static implicit operator uint(@uint val) => val.Value; 569 #endregion 570 571 #region Types 572 #endregion 573 } 574 [StructLayout(LayoutKind.Explicit, CharSet = CharSet.Unicode, Pack = 8, Size = 8)] 575 public struct @ulong: IProduct<ulong>, IClone<@ulong>, IEquality<@ulong>, IHashable, IInto<@ulong>, IInto<string>, IOrd<@ulong> { 576 577 #region Type-level Constructors 578 #endregion 579 580 #region Instance Constructors 581 public @ulong() => Value = ulong.MinValue; 582 public @ulong(ulong val) => Value = val; 583 #endregion 584 585 #region Type-level Fields 586 #endregion 587 588 #region Instance Fields 589 [FieldOffset(0)] public ulong Value; 590 #endregion 591 592 #region Type-level Properties 593 #endregion 594 595 #region Instance Properties 596 public readonly ulong Field0 => Value; 597 #endregion 598 599 #region Type-level Functions 600 #endregion 601 602 #region Instance Functions 603 public readonly @ulong Clone() => this; 604 public readonly Ordering Cmp(in @ulong other) => Value.CompareTo(other.Value) switch { 605 606 < 0 => Less, 607 > 0 => Greater, 608 0 => Equivalent, 609 }; 610 public readonly void Deconstruct(out ulong t0) => t0 = Value; 611 public readonly bool Equals(in @ulong other) => this == other; 612 public override readonly bool Equals(object? _) => false; 613 public override readonly int GetHashCode() => 0; 614 public readonly Unit Hash<THasher>(ref THasher hasher) where THasher: notnull, IHasher => hasher.WriteUnsafe(this); 615 public readonly @ulong Into() => this; 616 public readonly string IntoString() => ToString(); 617 readonly string IInto<string>.Into() => IntoString(); 618 public readonly Maybe<Ordering> PartialCmp(in @ulong other) => Some(Cmp(in other)); 619 public override readonly string ToString() => Value.ToString(); 620 readonly Result<@ulong, Bottom> ITryInto<@ulong, Bottom>.TryInto() => new(this); 621 readonly Result<string, Bottom> ITryInto<string, Bottom>.TryInto() => new(ToString()); 622 #endregion 623 624 #region Operators 625 public static bool operator !=(@ulong val0, @ulong val1) => val0.Value != val1.Value; 626 public static bool operator <(@ulong val0, @ulong val1) => val0.Value < val1.Value; 627 public static bool operator <=(@ulong val0, @ulong val1) => val0.Value <= val1.Value; 628 public static bool operator ==(@ulong val0, @ulong val1) => val0.Value == val1.Value; 629 public static bool operator >(@ulong val0, @ulong val1) => val0.Value > val1.Value; 630 public static bool operator >=(@ulong val0, @ulong val1) => val0.Value >= val1.Value; 631 public static implicit operator @ulong(ulong val) => new(val); 632 public static implicit operator ulong(@ulong val) => val.Value; 633 #endregion 634 635 #region Types 636 #endregion 637 } 638 [StructLayout(LayoutKind.Explicit, CharSet = CharSet.Unicode, Pack = 2, Size = 2)] 639 public struct @ushort: IProduct<ushort>, IClone<@ushort>, IEquality<@ushort>, IHashable, IInto<@ushort>, IInto<string>, IOrd<@ushort> { 640 641 #region Type-level Constructors 642 #endregion 643 644 #region Instance Constructors 645 public @ushort() => Value = ushort.MinValue; 646 public @ushort(ushort val) => Value = val; 647 #endregion 648 649 #region Type-level Fields 650 #endregion 651 652 #region Instance Fields 653 [FieldOffset(0)] public ushort Value; 654 #endregion 655 656 #region Type-level Properties 657 #endregion 658 659 #region Instance Properties 660 public readonly ushort Field0 => Value; 661 #endregion 662 663 #region Type-level Functions 664 #endregion 665 666 #region Instance Functions 667 public readonly @ushort Clone() => this; 668 public readonly Ordering Cmp(in @ushort other) => Value.CompareTo(other.Value) switch { 669 670 < 0 => Less, 671 > 0 => Greater, 672 0 => Equivalent, 673 }; 674 public readonly void Deconstruct(out ushort t0) => t0 = Value; 675 public readonly bool Equals(in @ushort other) => this == other; 676 public override readonly bool Equals(object? _) => false; 677 public override readonly int GetHashCode() => 0; 678 public readonly Unit Hash<THasher>(ref THasher hasher) where THasher: notnull, IHasher => hasher.WriteUnsafe(this); 679 public readonly @ushort Into() => this; 680 public readonly string IntoString() => ToString(); 681 readonly string IInto<string>.Into() => IntoString(); 682 public readonly Maybe<Ordering> PartialCmp(in @ushort other) => Some(Cmp(in other)); 683 public override readonly string ToString() => Value.ToString(); 684 readonly Result<@ushort, Bottom> ITryInto<@ushort, Bottom>.TryInto() => new(this); 685 readonly Result<string, Bottom> ITryInto<string, Bottom>.TryInto() => new(ToString()); 686 #endregion 687 688 #region Operators 689 public static bool operator !=(@ushort val0, @ushort val1) => val0.Value != val1.Value; 690 public static bool operator <(@ushort val0, @ushort val1) => val0.Value < val1.Value; 691 public static bool operator <=(@ushort val0, @ushort val1) => val0.Value <= val1.Value; 692 public static bool operator ==(@ushort val0, @ushort val1) => val0.Value == val1.Value; 693 public static bool operator >(@ushort val0, @ushort val1) => val0.Value > val1.Value; 694 public static bool operator >=(@ushort val0, @ushort val1) => val0.Value >= val1.Value; 695 public static implicit operator @ushort(ushort val) => new(val); 696 public static implicit operator ushort(@ushort val) => val.Value; 697 #endregion 698 699 #region Types 700 #endregion 701 } 702 #endregion 703 704 #region Namespaces 705 #endregion 706 } 707 #endregion