sharplib/imm/iu.cs
2024-02-09 15:49:42 -08:00

41 lines
1.1 KiB
C#

// A spot for immutable helpers
// TODO
// TODO
// TODO
// x) Wrap metadata into its own struct
// x) Make metadata a struct vs a class
using imm;
using System;
using System.Runtime.CompilerServices;
static public class iu
{
//This can handle both Timed and Recorded
static public T Process<T>( ref T obj, Func<T, T> fn, string reason = "",
[CallerMemberName] string memberName = "",
[CallerFilePath] string filePath = "",
[CallerLineNumber] int lineNumber = 0,
[CallerArgumentExpression("fn")]
string expression = default )
where T : Recorded<T>
{
obj = obj.Process( fn, reason, memberName, filePath, lineNumber, expression );
return obj;
}
static public T LightProcess<T>( ref T obj, Func<T, T> fn, string reason = "",
[CallerMemberName] string memberName = "",
[CallerFilePath] string filePath = "",
[CallerLineNumber] int lineNumber = 0,
[CallerArgumentExpression("fn")]
string expression = default )
where T : Versioned<T>
{
obj = obj.Process( fn, reason );
return obj;
}
}