Std

Mainly a port of Rust's std.
git clone https://git.philomathiclife.com/repos/Std
Log | Files | Refs | README

Convert.cs (3573B)


      1 using Std.Result;
      2 #region Namespaces
      3 namespace Std.Convert {
      4     #region Types
      5     public interface IFrom<TSelf, T>: ITryFrom<TSelf, T, Bottom> where TSelf: notnull, IFrom<TSelf, T> where T: notnull {
      6 
      7         #region Type-level Constructors
      8         #endregion
      9 
     10         #region Instance Constructors
     11         #endregion
     12 
     13         #region Type-level Fields
     14         #endregion
     15 
     16         #region Instance Fields
     17         #endregion
     18 
     19         #region Type-level Properties
     20         #endregion
     21 
     22         #region Instance Properties
     23         #endregion
     24 
     25         #region Type-level Functions
     26         public static abstract TSelf From(T val);
     27         #endregion
     28 
     29         #region Instance Functions
     30         #endregion
     31 
     32         #region Operators
     33         #endregion
     34 
     35         #region Types
     36         #endregion
     37     }
     38     public interface IInto<T>: ITryInto<T, Bottom> where T: notnull {
     39 
     40         #region Type-level Constructors
     41         #endregion
     42 
     43         #region Instance Constructors
     44         #endregion
     45 
     46         #region Type-level Fields
     47         #endregion
     48 
     49         #region Instance Fields
     50         #endregion
     51 
     52         #region Type-level Properties
     53         #endregion
     54 
     55         #region Instance Properties
     56         #endregion
     57 
     58         #region Type-level Functions
     59         #endregion
     60 
     61         #region Instance Functions
     62         public abstract T Into();
     63         #endregion
     64 
     65         #region Operators
     66         #endregion
     67 
     68         #region Types
     69         #endregion
     70     }
     71     public interface ITryFrom<TSelf, T, TErr> where TSelf: notnull, ITryFrom<TSelf, T, TErr> where T: notnull where TErr: notnull {
     72 
     73         #region Type-level Constructors
     74         #endregion
     75 
     76         #region Instance Constructors
     77         #endregion
     78 
     79         #region Type-level Fields
     80         #endregion
     81 
     82         #region Instance Fields
     83         #endregion
     84 
     85         #region Type-level Properties
     86         #endregion
     87 
     88         #region Instance Properties
     89         #endregion
     90 
     91         #region Type-level Functions
     92         public static abstract Result<TSelf, TErr> TryFrom(T val);
     93         #endregion
     94 
     95         #region Instance Functions
     96         #endregion
     97 
     98         #region Operators
     99         #endregion
    100 
    101         #region Types
    102         #endregion
    103     }
    104     public interface ITryInto<T, TErr> where T: notnull where TErr: notnull {
    105 
    106         #region Type-level Constructors
    107         #endregion
    108 
    109         #region Instance Constructors
    110         #endregion
    111 
    112         #region Type-level Fields
    113         #endregion
    114 
    115         #region Instance Fields
    116         #endregion
    117 
    118         #region Type-level Properties
    119         #endregion
    120 
    121         #region Instance Properties
    122         #endregion
    123 
    124         #region Type-level Functions
    125         #endregion
    126 
    127         #region Instance Functions
    128         public abstract Result<T, TErr> TryInto();
    129         #endregion
    130 
    131         #region Operators
    132         #endregion
    133 
    134         #region Types
    135         #endregion
    136     }
    137     public static class Functions {
    138 
    139         #region Type-level Constructors
    140         #endregion
    141 
    142         #region Instance Constructors
    143         #endregion
    144 
    145         #region Type-level Fields
    146         #endregion
    147 
    148         #region Instance Fields
    149         #endregion
    150 
    151         #region Type-level Properties
    152         #endregion
    153 
    154         #region Instance Properties
    155         #endregion
    156 
    157         #region Type-level Functions
    158         public static T Identity<T>(T val) where T: notnull => val;
    159         #endregion
    160 
    161         #region Instance Functions
    162         #endregion
    163 
    164         #region Operators
    165         #endregion
    166 
    167         #region Types
    168         #endregion
    169     }
    170     #endregion
    171 
    172     #region Namespaces
    173     #endregion
    174 }
    175 #endregion