feat: aetherbind, first source generator
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
using OwofGames.GodotLume;
|
||||
|
||||
namespace GodotHostTest.AetherBind;
|
||||
|
||||
public static class BuilderExtensions
|
||||
{
|
||||
public static Builder AddValueProvider<TValueType, TSourceScope, TDestinationScope>(this Builder builder)
|
||||
where TSourceScope : RootScope
|
||||
where TDestinationScope : TSourceScope
|
||||
{
|
||||
var valueProvider = new ValueProvider<TValueType>();
|
||||
return builder
|
||||
.AddScoped<IValueSetter<TValueType>, IValueSetter<TValueType>, TSourceScope>(Builder.NoDependencies,
|
||||
_ => valueProvider.Setter)
|
||||
.AddScoped<IValueGetter<TValueType>, IValueGetter<TValueType>, TDestinationScope>(Builder.NoDependencies,
|
||||
_ => valueProvider.Getter);
|
||||
}
|
||||
|
||||
public static Builder AddValueProvider<TValueType, TScope>(this Builder builder)
|
||||
where TScope : RootScope
|
||||
{
|
||||
return builder.AddValueProvider<TValueType, TScope, TScope>();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user