Empty.cs (2789B)
1 using Std.Clone; 2 using Std.Convert; 3 using Std.Maybe; 4 using static Std.Maybe.Maybe<ulong>; 5 using Std.Ops; 6 using Std.Result; 7 using static Std.Result.Result<Std.Unit, ulong>; 8 using System.Runtime.InteropServices; 9 #region Namespaces 10 namespace Std.Iter { 11 #region Types 12 [StructLayout(LayoutKind.Explicit, CharSet = CharSet.Unicode, Pack = 1, Size = 1)] 13 public readonly struct Empty<T>: IClone<Empty<T>>, IDoubleEndedIterator<T>, IExactSizeIterator<T>, IFusedIterator<T>, IInto<Empty<T>> where T: notnull { 14 15 #region Type-level Constructors 16 #endregion 17 18 #region Instance Constructors 19 public Empty() { } 20 #endregion 21 22 #region Type-level Fields 23 #endregion 24 25 #region Instance Fields 26 #endregion 27 28 #region Type-level Properties 29 #endregion 30 31 #region Instance Properties 32 #endregion 33 34 #region Type-level Functions 35 #endregion 36 37 #region Instance Functions 38 public readonly Result<Unit, ulong> AdvanceBackBy(ulong n) => n == ulong.MinValue ? OK(new Unit()) : Err(ulong.MinValue); 39 public readonly Result<Unit, ulong> AdvanceBy(ulong n) => n == ulong.MinValue ? OK(new Unit()) : Err(ulong.MinValue); 40 public readonly Empty<T> Clone() => this; 41 public readonly ulong Count() => ulong.MinValue; 42 public override readonly bool Equals(object? _) => false; 43 public readonly TInit Fold<TInit>(TInit init, Fn<TInit, T, TInit> f) where TInit: notnull => init; 44 public override readonly int GetHashCode() => 0; 45 public readonly Empty<T> Into() => this; 46 public readonly bool IsEmpty() => true; 47 public readonly Maybe<T> Last() => Maybe<T>.None(); 48 public readonly ulong Len() => ulong.MinValue; 49 public readonly Maybe<T> Next() => Maybe<T>.None(); 50 public readonly Maybe<T> NextBack() => Maybe<T>.None(); 51 readonly TInit IDoubleEndedIterator<T>.RFold<TInit>(TInit init, Fn<TInit, T, TInit> f) => init; 52 public readonly Prod<ulong, Maybe<ulong>> SizeHint() => new(ulong.MinValue, Some(ulong.MinValue)); 53 public override readonly string ToString() => string.Empty; 54 public readonly Result<TInit, TErr> TryFold<TInit, TErr>(TInit init, Fn<TInit, T, Result<TInit, TErr>> f) where TInit: notnull where TErr: notnull => new(init); 55 readonly Result<Empty<T>, Bottom> ITryInto<Empty<T>, Bottom>.TryInto() => new(this); 56 public readonly Result<TInit, TErr> TryRFold<TInit, TErr>(TInit init, Fn<TInit, T, Result<TInit, TErr>> f) where TInit: notnull where TErr: notnull => new(init); 57 #endregion 58 59 #region Operators 60 #endregion 61 62 #region Types 63 #endregion 64 } 65 #endregion 66 67 #region Namespaces 68 #endregion 69 } 70 #endregion