Consolidate imports, wrap metadata in struct, update type constraints

x) Consolidate imports for Immutable collections
x) Wrap metadata into its own struct
x) Update type constraints for generic methods
This commit is contained in:
Marc Hernandez 2024-07-01 14:47:24 -07:00
parent 066d3bc7f9
commit be02b6f91f
2 changed files with 8 additions and 6 deletions

View File

@ -1,6 +1,9 @@
global using Imm = System.Collections.Immutable;
global using II = System.Collections.Immutable.ImmutableInterlocked;
global using ImmArray = System.Collections.Immutable.ImmutableArray; global using ImmArray = System.Collections.Immutable.ImmutableArray;
global using ImmDict = System.Collections.Immutable.ImmutableDictionary; global using ImmDict = System.Collections.Immutable.ImmutableDictionary;
global using ImmSet = System.Collections.Immutable.ImmutableHashSet; global using ImmSet = System.Collections.Immutable.ImmutableHashSet;
global using II = System.Collections.Immutable.ImmutableInterlocked;

View File

@ -7,7 +7,6 @@
// x) Wrap metadata into its own struct // x) Wrap metadata into its own struct
// x) Make metadata a struct vs a class // x) Make metadata a struct vs a class
using imm;
using System; using System;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
@ -22,20 +21,20 @@ static public class iu
[CallerLineNumber] int dbgLine = 0, [CallerLineNumber] int dbgLine = 0,
[CallerArgumentExpression("fn")] [CallerArgumentExpression("fn")]
string dbgExpression = default ) string dbgExpression = default )
where T : Recorded<T>, Imm where T : imm.Recorded<T>, imm.Imm
{ {
obj = obj.Process( fn, reason, dbgName, dbgPath, dbgLine, dbgExpression ); obj = obj.Process( fn, reason, dbgName, dbgPath, dbgLine, dbgExpression );
return obj; return obj;
} }
static public Timed<T> Process<T>( ref Timed<T> obj, Func<T, T> fn, static public imm.Timed<T> Process<T>( ref imm.Timed<T> obj, Func<T, T> fn,
string reason = "", string reason = "",
[CallerMemberName] string dbgName = "", [CallerMemberName] string dbgName = "",
[CallerFilePath] string dbgPath = "", [CallerFilePath] string dbgPath = "",
[CallerLineNumber] int dbgLine = 0, [CallerLineNumber] int dbgLine = 0,
[CallerArgumentExpression("fn")] [CallerArgumentExpression("fn")]
string dbgExpression = default ) string dbgExpression = default )
where T : Timed<T>, Imm where T : imm.Timed<T>, imm.Imm
{ {
obj = obj.Process( fn, reason, dbgName, dbgPath, dbgLine, dbgExpression ); obj = obj.Process( fn, reason, dbgName, dbgPath, dbgLine, dbgExpression );
return obj; return obj;
@ -49,7 +48,7 @@ static public class iu
[CallerLineNumber] int dbgLine = 0, [CallerLineNumber] int dbgLine = 0,
[CallerArgumentExpression("fn")] [CallerArgumentExpression("fn")]
string dbgExpression = default ) string dbgExpression = default )
where T : Versioned<T>, Imm where T : imm.Versioned<T>, imm.Imm
{ {
obj = obj.Process( fn, reason ); obj = obj.Process( fn, reason );
return obj; return obj;