This commit is contained in:
parent
08bc35db29
commit
13a34e83d7
|
@ -1,8 +1,7 @@
|
|||
using System.Threading;
|
||||
using ServicePoint;
|
||||
|
||||
// TODO: replace with new Connection("127.0.0.1:2342") to send to a real display
|
||||
var connection = Connection.NewFake();
|
||||
var connection = new Connection("127.0.0.1:2342");
|
||||
connection.Send(Command.Clear());
|
||||
|
||||
connection.Send(Command.Brightness(5));
|
||||
|
|
|
@ -15,6 +15,8 @@ using System.Linq;
|
|||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
namespace ServicePoint;
|
||||
using Brightness = Byte;
|
||||
using FfiConverterTypeBrightness = FfiConverterUInt8;
|
||||
|
||||
|
||||
|
||||
|
@ -816,6 +818,22 @@ static class _UniFFILib {
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -936,6 +954,18 @@ static class _UniFFILib {
|
|||
public static extern ulong uniffi_servicepoint_binding_uniffi_fn_method_bitmap_width(IntPtr @ptr,ref UniffiRustCallStatus _uniffi_out_err
|
||||
);
|
||||
|
||||
[DllImport("servicepoint_binding_uniffi", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern IntPtr uniffi_servicepoint_binding_uniffi_fn_clone_bitmaplegacycommand(IntPtr @ptr,ref UniffiRustCallStatus _uniffi_out_err
|
||||
);
|
||||
|
||||
[DllImport("servicepoint_binding_uniffi", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void uniffi_servicepoint_binding_uniffi_fn_free_bitmaplegacycommand(IntPtr @ptr,ref UniffiRustCallStatus _uniffi_out_err
|
||||
);
|
||||
|
||||
[DllImport("servicepoint_binding_uniffi", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern IntPtr uniffi_servicepoint_binding_uniffi_fn_constructor_bitmaplegacycommand_new(ref UniffiRustCallStatus _uniffi_out_err
|
||||
);
|
||||
|
||||
[DllImport("servicepoint_binding_uniffi", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern IntPtr uniffi_servicepoint_binding_uniffi_fn_clone_brightnessgrid(IntPtr @ptr,ref UniffiRustCallStatus _uniffi_out_err
|
||||
);
|
||||
|
@ -1052,6 +1082,18 @@ static class _UniFFILib {
|
|||
public static extern ulong uniffi_servicepoint_binding_uniffi_fn_method_chargrid_width(IntPtr @ptr,ref UniffiRustCallStatus _uniffi_out_err
|
||||
);
|
||||
|
||||
[DllImport("servicepoint_binding_uniffi", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern IntPtr uniffi_servicepoint_binding_uniffi_fn_clone_clearcommand(IntPtr @ptr,ref UniffiRustCallStatus _uniffi_out_err
|
||||
);
|
||||
|
||||
[DllImport("servicepoint_binding_uniffi", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void uniffi_servicepoint_binding_uniffi_fn_free_clearcommand(IntPtr @ptr,ref UniffiRustCallStatus _uniffi_out_err
|
||||
);
|
||||
|
||||
[DllImport("servicepoint_binding_uniffi", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern IntPtr uniffi_servicepoint_binding_uniffi_fn_constructor_clearcommand_new(ref UniffiRustCallStatus _uniffi_out_err
|
||||
);
|
||||
|
||||
[DllImport("servicepoint_binding_uniffi", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern IntPtr uniffi_servicepoint_binding_uniffi_fn_clone_command(IntPtr @ptr,ref UniffiRustCallStatus _uniffi_out_err
|
||||
);
|
||||
|
@ -1172,6 +1214,30 @@ static class _UniFFILib {
|
|||
public static extern ulong uniffi_servicepoint_binding_uniffi_fn_method_cp437grid_width(IntPtr @ptr,ref UniffiRustCallStatus _uniffi_out_err
|
||||
);
|
||||
|
||||
[DllImport("servicepoint_binding_uniffi", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern IntPtr uniffi_servicepoint_binding_uniffi_fn_clone_fadeoutcommand(IntPtr @ptr,ref UniffiRustCallStatus _uniffi_out_err
|
||||
);
|
||||
|
||||
[DllImport("servicepoint_binding_uniffi", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void uniffi_servicepoint_binding_uniffi_fn_free_fadeoutcommand(IntPtr @ptr,ref UniffiRustCallStatus _uniffi_out_err
|
||||
);
|
||||
|
||||
[DllImport("servicepoint_binding_uniffi", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern IntPtr uniffi_servicepoint_binding_uniffi_fn_constructor_fadeoutcommand_new(ref UniffiRustCallStatus _uniffi_out_err
|
||||
);
|
||||
|
||||
[DllImport("servicepoint_binding_uniffi", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern IntPtr uniffi_servicepoint_binding_uniffi_fn_clone_hardresetcommand(IntPtr @ptr,ref UniffiRustCallStatus _uniffi_out_err
|
||||
);
|
||||
|
||||
[DllImport("servicepoint_binding_uniffi", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void uniffi_servicepoint_binding_uniffi_fn_free_hardresetcommand(IntPtr @ptr,ref UniffiRustCallStatus _uniffi_out_err
|
||||
);
|
||||
|
||||
[DllImport("servicepoint_binding_uniffi", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern IntPtr uniffi_servicepoint_binding_uniffi_fn_constructor_hardresetcommand_new(ref UniffiRustCallStatus _uniffi_out_err
|
||||
);
|
||||
|
||||
[DllImport("servicepoint_binding_uniffi", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern RustBuffer uniffi_servicepoint_binding_uniffi_fn_func_get_constants(ref UniffiRustCallStatus _uniffi_out_err
|
||||
);
|
||||
|
@ -1600,6 +1666,10 @@ static class _UniFFILib {
|
|||
public static extern ushort uniffi_servicepoint_binding_uniffi_checksum_constructor_bitmap_new_max_sized(
|
||||
);
|
||||
|
||||
[DllImport("servicepoint_binding_uniffi", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern ushort uniffi_servicepoint_binding_uniffi_checksum_constructor_bitmaplegacycommand_new(
|
||||
);
|
||||
|
||||
[DllImport("servicepoint_binding_uniffi", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern ushort uniffi_servicepoint_binding_uniffi_checksum_constructor_brightnessgrid_clone(
|
||||
);
|
||||
|
@ -1624,6 +1694,10 @@ static class _UniFFILib {
|
|||
public static extern ushort uniffi_servicepoint_binding_uniffi_checksum_constructor_chargrid_new(
|
||||
);
|
||||
|
||||
[DllImport("servicepoint_binding_uniffi", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern ushort uniffi_servicepoint_binding_uniffi_checksum_constructor_clearcommand_new(
|
||||
);
|
||||
|
||||
[DllImport("servicepoint_binding_uniffi", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern ushort uniffi_servicepoint_binding_uniffi_checksum_constructor_command_bitmap_linear(
|
||||
);
|
||||
|
@ -1680,6 +1754,14 @@ static class _UniFFILib {
|
|||
public static extern ushort uniffi_servicepoint_binding_uniffi_checksum_constructor_cp437grid_new(
|
||||
);
|
||||
|
||||
[DllImport("servicepoint_binding_uniffi", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern ushort uniffi_servicepoint_binding_uniffi_checksum_constructor_fadeoutcommand_new(
|
||||
);
|
||||
|
||||
[DllImport("servicepoint_binding_uniffi", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern ushort uniffi_servicepoint_binding_uniffi_checksum_constructor_hardresetcommand_new(
|
||||
);
|
||||
|
||||
[DllImport("servicepoint_binding_uniffi", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern uint ffi_servicepoint_binding_uniffi_uniffi_contract_version(
|
||||
);
|
||||
|
@ -1792,14 +1874,14 @@ static class _UniFFILib {
|
|||
}
|
||||
{
|
||||
var checksum = _UniFFILib.uniffi_servicepoint_binding_uniffi_checksum_method_brightnessgrid_fill();
|
||||
if (checksum != 47185) {
|
||||
throw new UniffiContractChecksumException($"ServicePoint: uniffi bindings expected function `uniffi_servicepoint_binding_uniffi_checksum_method_brightnessgrid_fill` checksum `47185`, library returned `{checksum}`");
|
||||
if (checksum != 46387) {
|
||||
throw new UniffiContractChecksumException($"ServicePoint: uniffi bindings expected function `uniffi_servicepoint_binding_uniffi_checksum_method_brightnessgrid_fill` checksum `46387`, library returned `{checksum}`");
|
||||
}
|
||||
}
|
||||
{
|
||||
var checksum = _UniFFILib.uniffi_servicepoint_binding_uniffi_checksum_method_brightnessgrid_get();
|
||||
if (checksum != 39844) {
|
||||
throw new UniffiContractChecksumException($"ServicePoint: uniffi bindings expected function `uniffi_servicepoint_binding_uniffi_checksum_method_brightnessgrid_get` checksum `39844`, library returned `{checksum}`");
|
||||
if (checksum != 47112) {
|
||||
throw new UniffiContractChecksumException($"ServicePoint: uniffi bindings expected function `uniffi_servicepoint_binding_uniffi_checksum_method_brightnessgrid_get` checksum `47112`, library returned `{checksum}`");
|
||||
}
|
||||
}
|
||||
{
|
||||
|
@ -1810,8 +1892,8 @@ static class _UniFFILib {
|
|||
}
|
||||
{
|
||||
var checksum = _UniFFILib.uniffi_servicepoint_binding_uniffi_checksum_method_brightnessgrid_set();
|
||||
if (checksum != 24064) {
|
||||
throw new UniffiContractChecksumException($"ServicePoint: uniffi bindings expected function `uniffi_servicepoint_binding_uniffi_checksum_method_brightnessgrid_set` checksum `24064`, library returned `{checksum}`");
|
||||
if (checksum != 27525) {
|
||||
throw new UniffiContractChecksumException($"ServicePoint: uniffi bindings expected function `uniffi_servicepoint_binding_uniffi_checksum_method_brightnessgrid_set` checksum `27525`, library returned `{checksum}`");
|
||||
}
|
||||
}
|
||||
{
|
||||
|
@ -1994,6 +2076,12 @@ static class _UniFFILib {
|
|||
throw new UniffiContractChecksumException($"ServicePoint: uniffi bindings expected function `uniffi_servicepoint_binding_uniffi_checksum_constructor_bitmap_new_max_sized` checksum `47687`, library returned `{checksum}`");
|
||||
}
|
||||
}
|
||||
{
|
||||
var checksum = _UniFFILib.uniffi_servicepoint_binding_uniffi_checksum_constructor_bitmaplegacycommand_new();
|
||||
if (checksum != 44315) {
|
||||
throw new UniffiContractChecksumException($"ServicePoint: uniffi bindings expected function `uniffi_servicepoint_binding_uniffi_checksum_constructor_bitmaplegacycommand_new` checksum `44315`, library returned `{checksum}`");
|
||||
}
|
||||
}
|
||||
{
|
||||
var checksum = _UniFFILib.uniffi_servicepoint_binding_uniffi_checksum_constructor_brightnessgrid_clone();
|
||||
if (checksum != 56444) {
|
||||
|
@ -2030,6 +2118,12 @@ static class _UniFFILib {
|
|||
throw new UniffiContractChecksumException($"ServicePoint: uniffi bindings expected function `uniffi_servicepoint_binding_uniffi_checksum_constructor_chargrid_new` checksum `2094`, library returned `{checksum}`");
|
||||
}
|
||||
}
|
||||
{
|
||||
var checksum = _UniFFILib.uniffi_servicepoint_binding_uniffi_checksum_constructor_clearcommand_new();
|
||||
if (checksum != 340) {
|
||||
throw new UniffiContractChecksumException($"ServicePoint: uniffi bindings expected function `uniffi_servicepoint_binding_uniffi_checksum_constructor_clearcommand_new` checksum `340`, library returned `{checksum}`");
|
||||
}
|
||||
}
|
||||
{
|
||||
var checksum = _UniFFILib.uniffi_servicepoint_binding_uniffi_checksum_constructor_command_bitmap_linear();
|
||||
if (checksum != 62752) {
|
||||
|
@ -2114,6 +2208,18 @@ static class _UniFFILib {
|
|||
throw new UniffiContractChecksumException($"ServicePoint: uniffi bindings expected function `uniffi_servicepoint_binding_uniffi_checksum_constructor_cp437grid_new` checksum `8874`, library returned `{checksum}`");
|
||||
}
|
||||
}
|
||||
{
|
||||
var checksum = _UniFFILib.uniffi_servicepoint_binding_uniffi_checksum_constructor_fadeoutcommand_new();
|
||||
if (checksum != 9933) {
|
||||
throw new UniffiContractChecksumException($"ServicePoint: uniffi bindings expected function `uniffi_servicepoint_binding_uniffi_checksum_constructor_fadeoutcommand_new` checksum `9933`, library returned `{checksum}`");
|
||||
}
|
||||
}
|
||||
{
|
||||
var checksum = _UniFFILib.uniffi_servicepoint_binding_uniffi_checksum_constructor_hardresetcommand_new();
|
||||
if (checksum != 65216) {
|
||||
throw new UniffiContractChecksumException($"ServicePoint: uniffi bindings expected function `uniffi_servicepoint_binding_uniffi_checksum_constructor_hardresetcommand_new` checksum `65216`, library returned `{checksum}`");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2680,13 +2786,139 @@ class FfiConverterTypeBitmap: FfiConverter<Bitmap, IntPtr> {
|
|||
|
||||
|
||||
|
||||
public interface IBitmapLegacyCommand {
|
||||
}
|
||||
public class BitmapLegacyCommand : IBitmapLegacyCommand, IDisposable {
|
||||
protected IntPtr pointer;
|
||||
private int _wasDestroyed = 0;
|
||||
private long _callCounter = 1;
|
||||
|
||||
public BitmapLegacyCommand(IntPtr pointer) {
|
||||
this.pointer = pointer;
|
||||
}
|
||||
|
||||
~BitmapLegacyCommand() {
|
||||
Destroy();
|
||||
}
|
||||
public BitmapLegacyCommand() :
|
||||
this(
|
||||
_UniffiHelpers.RustCall( (ref UniffiRustCallStatus _status) =>
|
||||
_UniFFILib.uniffi_servicepoint_binding_uniffi_fn_constructor_bitmaplegacycommand_new( ref _status)
|
||||
)) {}
|
||||
|
||||
protected void FreeRustArcPtr() {
|
||||
_UniffiHelpers.RustCall((ref UniffiRustCallStatus status) => {
|
||||
_UniFFILib.uniffi_servicepoint_binding_uniffi_fn_free_bitmaplegacycommand(this.pointer, ref status);
|
||||
});
|
||||
}
|
||||
|
||||
protected IntPtr CloneRustArcPtr() {
|
||||
return _UniffiHelpers.RustCall((ref UniffiRustCallStatus status) => {
|
||||
return _UniFFILib.uniffi_servicepoint_binding_uniffi_fn_clone_bitmaplegacycommand(this.pointer, ref status);
|
||||
});
|
||||
}
|
||||
|
||||
public void Destroy()
|
||||
{
|
||||
// Only allow a single call to this method.
|
||||
if (Interlocked.CompareExchange(ref _wasDestroyed, 1, 0) == 0)
|
||||
{
|
||||
// This decrement always matches the initial count of 1 given at creation time.
|
||||
if (Interlocked.Decrement(ref _callCounter) == 0)
|
||||
{
|
||||
FreeRustArcPtr();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Destroy();
|
||||
GC.SuppressFinalize(this); // Suppress finalization to avoid unnecessary GC overhead.
|
||||
}
|
||||
|
||||
private void IncrementCallCounter()
|
||||
{
|
||||
// Check and increment the call counter, to keep the object alive.
|
||||
// This needs a compare-and-set retry loop in case of concurrent updates.
|
||||
long count;
|
||||
do
|
||||
{
|
||||
count = Interlocked.Read(ref _callCounter);
|
||||
if (count == 0L) throw new System.ObjectDisposedException(String.Format("'{0}' object has already been destroyed", this.GetType().Name));
|
||||
if (count == long.MaxValue) throw new System.OverflowException(String.Format("'{0}' call counter would overflow", this.GetType().Name));
|
||||
|
||||
} while (Interlocked.CompareExchange(ref _callCounter, count + 1, count) != count);
|
||||
}
|
||||
|
||||
private void DecrementCallCounter()
|
||||
{
|
||||
// This decrement always matches the increment we performed above.
|
||||
if (Interlocked.Decrement(ref _callCounter) == 0) {
|
||||
FreeRustArcPtr();
|
||||
}
|
||||
}
|
||||
|
||||
internal void CallWithPointer(Action<IntPtr> action)
|
||||
{
|
||||
IncrementCallCounter();
|
||||
try {
|
||||
action(CloneRustArcPtr());
|
||||
}
|
||||
finally {
|
||||
DecrementCallCounter();
|
||||
}
|
||||
}
|
||||
|
||||
internal T CallWithPointer<T>(Func<IntPtr, T> func)
|
||||
{
|
||||
IncrementCallCounter();
|
||||
try {
|
||||
return func(CloneRustArcPtr());
|
||||
}
|
||||
finally {
|
||||
DecrementCallCounter();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
class FfiConverterTypeBitmapLegacyCommand: FfiConverter<BitmapLegacyCommand, IntPtr> {
|
||||
public static FfiConverterTypeBitmapLegacyCommand INSTANCE = new FfiConverterTypeBitmapLegacyCommand();
|
||||
|
||||
|
||||
public override IntPtr Lower(BitmapLegacyCommand value) {
|
||||
return value.CallWithPointer(thisPtr => thisPtr);
|
||||
}
|
||||
|
||||
public override BitmapLegacyCommand Lift(IntPtr value) {
|
||||
return new BitmapLegacyCommand(value);
|
||||
}
|
||||
|
||||
public override BitmapLegacyCommand Read(BigEndianStream stream) {
|
||||
return Lift(new IntPtr(stream.ReadLong()));
|
||||
}
|
||||
|
||||
public override int AllocationSize(BitmapLegacyCommand value) {
|
||||
return 8;
|
||||
}
|
||||
|
||||
public override void Write(BitmapLegacyCommand value, BigEndianStream stream) {
|
||||
stream.WriteLong(Lower(value).ToInt64());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public interface IBrightnessGrid {
|
||||
byte[] CopyRaw();
|
||||
bool Equals(BrightnessGrid @other);
|
||||
void Fill(byte @value);
|
||||
byte Get(ulong @x, ulong @y);
|
||||
void Fill(Brightness @value);
|
||||
Brightness Get(ulong @x, ulong @y);
|
||||
ulong Height();
|
||||
void Set(ulong @x, ulong @y, byte @value);
|
||||
void Set(ulong @x, ulong @y, Brightness @value);
|
||||
ulong Width();
|
||||
}
|
||||
public class BrightnessGrid : IBrightnessGrid, IDisposable {
|
||||
|
@ -2799,17 +3031,17 @@ public class BrightnessGrid : IBrightnessGrid, IDisposable {
|
|||
}
|
||||
|
||||
|
||||
public void Fill(byte @value) {
|
||||
public void Fill(Brightness @value) {
|
||||
CallWithPointer(thisPtr =>
|
||||
_UniffiHelpers.RustCall( (ref UniffiRustCallStatus _status) =>
|
||||
_UniFFILib.uniffi_servicepoint_binding_uniffi_fn_method_brightnessgrid_fill(thisPtr, FfiConverterUInt8.INSTANCE.Lower(@value), ref _status)
|
||||
_UniFFILib.uniffi_servicepoint_binding_uniffi_fn_method_brightnessgrid_fill(thisPtr, FfiConverterTypeBrightness.INSTANCE.Lower(@value), ref _status)
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
|
||||
public byte Get(ulong @x, ulong @y) {
|
||||
return CallWithPointer(thisPtr => FfiConverterUInt8.INSTANCE.Lift(
|
||||
public Brightness Get(ulong @x, ulong @y) {
|
||||
return CallWithPointer(thisPtr => FfiConverterTypeBrightness.INSTANCE.Lift(
|
||||
_UniffiHelpers.RustCall( (ref UniffiRustCallStatus _status) =>
|
||||
_UniFFILib.uniffi_servicepoint_binding_uniffi_fn_method_brightnessgrid_get(thisPtr, FfiConverterUInt64.INSTANCE.Lower(@x), FfiConverterUInt64.INSTANCE.Lower(@y), ref _status)
|
||||
)));
|
||||
|
@ -2824,10 +3056,10 @@ public class BrightnessGrid : IBrightnessGrid, IDisposable {
|
|||
}
|
||||
|
||||
|
||||
public void Set(ulong @x, ulong @y, byte @value) {
|
||||
public void Set(ulong @x, ulong @y, Brightness @value) {
|
||||
CallWithPointer(thisPtr =>
|
||||
_UniffiHelpers.RustCall( (ref UniffiRustCallStatus _status) =>
|
||||
_UniFFILib.uniffi_servicepoint_binding_uniffi_fn_method_brightnessgrid_set(thisPtr, FfiConverterUInt64.INSTANCE.Lower(@x), FfiConverterUInt64.INSTANCE.Lower(@y), FfiConverterUInt8.INSTANCE.Lower(@value), ref _status)
|
||||
_UniFFILib.uniffi_servicepoint_binding_uniffi_fn_method_brightnessgrid_set(thisPtr, FfiConverterUInt64.INSTANCE.Lower(@x), FfiConverterUInt64.INSTANCE.Lower(@y), FfiConverterTypeBrightness.INSTANCE.Lower(@value), ref _status)
|
||||
));
|
||||
}
|
||||
|
||||
|
@ -3151,6 +3383,132 @@ class FfiConverterTypeCharGrid: FfiConverter<CharGrid, IntPtr> {
|
|||
|
||||
|
||||
|
||||
public interface IClearCommand {
|
||||
}
|
||||
public class ClearCommand : IClearCommand, IDisposable {
|
||||
protected IntPtr pointer;
|
||||
private int _wasDestroyed = 0;
|
||||
private long _callCounter = 1;
|
||||
|
||||
public ClearCommand(IntPtr pointer) {
|
||||
this.pointer = pointer;
|
||||
}
|
||||
|
||||
~ClearCommand() {
|
||||
Destroy();
|
||||
}
|
||||
public ClearCommand() :
|
||||
this(
|
||||
_UniffiHelpers.RustCall( (ref UniffiRustCallStatus _status) =>
|
||||
_UniFFILib.uniffi_servicepoint_binding_uniffi_fn_constructor_clearcommand_new( ref _status)
|
||||
)) {}
|
||||
|
||||
protected void FreeRustArcPtr() {
|
||||
_UniffiHelpers.RustCall((ref UniffiRustCallStatus status) => {
|
||||
_UniFFILib.uniffi_servicepoint_binding_uniffi_fn_free_clearcommand(this.pointer, ref status);
|
||||
});
|
||||
}
|
||||
|
||||
protected IntPtr CloneRustArcPtr() {
|
||||
return _UniffiHelpers.RustCall((ref UniffiRustCallStatus status) => {
|
||||
return _UniFFILib.uniffi_servicepoint_binding_uniffi_fn_clone_clearcommand(this.pointer, ref status);
|
||||
});
|
||||
}
|
||||
|
||||
public void Destroy()
|
||||
{
|
||||
// Only allow a single call to this method.
|
||||
if (Interlocked.CompareExchange(ref _wasDestroyed, 1, 0) == 0)
|
||||
{
|
||||
// This decrement always matches the initial count of 1 given at creation time.
|
||||
if (Interlocked.Decrement(ref _callCounter) == 0)
|
||||
{
|
||||
FreeRustArcPtr();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Destroy();
|
||||
GC.SuppressFinalize(this); // Suppress finalization to avoid unnecessary GC overhead.
|
||||
}
|
||||
|
||||
private void IncrementCallCounter()
|
||||
{
|
||||
// Check and increment the call counter, to keep the object alive.
|
||||
// This needs a compare-and-set retry loop in case of concurrent updates.
|
||||
long count;
|
||||
do
|
||||
{
|
||||
count = Interlocked.Read(ref _callCounter);
|
||||
if (count == 0L) throw new System.ObjectDisposedException(String.Format("'{0}' object has already been destroyed", this.GetType().Name));
|
||||
if (count == long.MaxValue) throw new System.OverflowException(String.Format("'{0}' call counter would overflow", this.GetType().Name));
|
||||
|
||||
} while (Interlocked.CompareExchange(ref _callCounter, count + 1, count) != count);
|
||||
}
|
||||
|
||||
private void DecrementCallCounter()
|
||||
{
|
||||
// This decrement always matches the increment we performed above.
|
||||
if (Interlocked.Decrement(ref _callCounter) == 0) {
|
||||
FreeRustArcPtr();
|
||||
}
|
||||
}
|
||||
|
||||
internal void CallWithPointer(Action<IntPtr> action)
|
||||
{
|
||||
IncrementCallCounter();
|
||||
try {
|
||||
action(CloneRustArcPtr());
|
||||
}
|
||||
finally {
|
||||
DecrementCallCounter();
|
||||
}
|
||||
}
|
||||
|
||||
internal T CallWithPointer<T>(Func<IntPtr, T> func)
|
||||
{
|
||||
IncrementCallCounter();
|
||||
try {
|
||||
return func(CloneRustArcPtr());
|
||||
}
|
||||
finally {
|
||||
DecrementCallCounter();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
class FfiConverterTypeClearCommand: FfiConverter<ClearCommand, IntPtr> {
|
||||
public static FfiConverterTypeClearCommand INSTANCE = new FfiConverterTypeClearCommand();
|
||||
|
||||
|
||||
public override IntPtr Lower(ClearCommand value) {
|
||||
return value.CallWithPointer(thisPtr => thisPtr);
|
||||
}
|
||||
|
||||
public override ClearCommand Lift(IntPtr value) {
|
||||
return new ClearCommand(value);
|
||||
}
|
||||
|
||||
public override ClearCommand Read(BigEndianStream stream) {
|
||||
return Lift(new IntPtr(stream.ReadLong()));
|
||||
}
|
||||
|
||||
public override int AllocationSize(ClearCommand value) {
|
||||
return 8;
|
||||
}
|
||||
|
||||
public override void Write(ClearCommand value, BigEndianStream stream) {
|
||||
stream.WriteLong(Lower(value).ToInt64());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public interface ICommand {
|
||||
bool Equals(Command @other);
|
||||
}
|
||||
|
@ -3706,6 +4064,258 @@ class FfiConverterTypeCp437Grid: FfiConverter<Cp437Grid, IntPtr> {
|
|||
|
||||
|
||||
|
||||
public interface IFadeOutCommand {
|
||||
}
|
||||
public class FadeOutCommand : IFadeOutCommand, IDisposable {
|
||||
protected IntPtr pointer;
|
||||
private int _wasDestroyed = 0;
|
||||
private long _callCounter = 1;
|
||||
|
||||
public FadeOutCommand(IntPtr pointer) {
|
||||
this.pointer = pointer;
|
||||
}
|
||||
|
||||
~FadeOutCommand() {
|
||||
Destroy();
|
||||
}
|
||||
public FadeOutCommand() :
|
||||
this(
|
||||
_UniffiHelpers.RustCall( (ref UniffiRustCallStatus _status) =>
|
||||
_UniFFILib.uniffi_servicepoint_binding_uniffi_fn_constructor_fadeoutcommand_new( ref _status)
|
||||
)) {}
|
||||
|
||||
protected void FreeRustArcPtr() {
|
||||
_UniffiHelpers.RustCall((ref UniffiRustCallStatus status) => {
|
||||
_UniFFILib.uniffi_servicepoint_binding_uniffi_fn_free_fadeoutcommand(this.pointer, ref status);
|
||||
});
|
||||
}
|
||||
|
||||
protected IntPtr CloneRustArcPtr() {
|
||||
return _UniffiHelpers.RustCall((ref UniffiRustCallStatus status) => {
|
||||
return _UniFFILib.uniffi_servicepoint_binding_uniffi_fn_clone_fadeoutcommand(this.pointer, ref status);
|
||||
});
|
||||
}
|
||||
|
||||
public void Destroy()
|
||||
{
|
||||
// Only allow a single call to this method.
|
||||
if (Interlocked.CompareExchange(ref _wasDestroyed, 1, 0) == 0)
|
||||
{
|
||||
// This decrement always matches the initial count of 1 given at creation time.
|
||||
if (Interlocked.Decrement(ref _callCounter) == 0)
|
||||
{
|
||||
FreeRustArcPtr();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Destroy();
|
||||
GC.SuppressFinalize(this); // Suppress finalization to avoid unnecessary GC overhead.
|
||||
}
|
||||
|
||||
private void IncrementCallCounter()
|
||||
{
|
||||
// Check and increment the call counter, to keep the object alive.
|
||||
// This needs a compare-and-set retry loop in case of concurrent updates.
|
||||
long count;
|
||||
do
|
||||
{
|
||||
count = Interlocked.Read(ref _callCounter);
|
||||
if (count == 0L) throw new System.ObjectDisposedException(String.Format("'{0}' object has already been destroyed", this.GetType().Name));
|
||||
if (count == long.MaxValue) throw new System.OverflowException(String.Format("'{0}' call counter would overflow", this.GetType().Name));
|
||||
|
||||
} while (Interlocked.CompareExchange(ref _callCounter, count + 1, count) != count);
|
||||
}
|
||||
|
||||
private void DecrementCallCounter()
|
||||
{
|
||||
// This decrement always matches the increment we performed above.
|
||||
if (Interlocked.Decrement(ref _callCounter) == 0) {
|
||||
FreeRustArcPtr();
|
||||
}
|
||||
}
|
||||
|
||||
internal void CallWithPointer(Action<IntPtr> action)
|
||||
{
|
||||
IncrementCallCounter();
|
||||
try {
|
||||
action(CloneRustArcPtr());
|
||||
}
|
||||
finally {
|
||||
DecrementCallCounter();
|
||||
}
|
||||
}
|
||||
|
||||
internal T CallWithPointer<T>(Func<IntPtr, T> func)
|
||||
{
|
||||
IncrementCallCounter();
|
||||
try {
|
||||
return func(CloneRustArcPtr());
|
||||
}
|
||||
finally {
|
||||
DecrementCallCounter();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
class FfiConverterTypeFadeOutCommand: FfiConverter<FadeOutCommand, IntPtr> {
|
||||
public static FfiConverterTypeFadeOutCommand INSTANCE = new FfiConverterTypeFadeOutCommand();
|
||||
|
||||
|
||||
public override IntPtr Lower(FadeOutCommand value) {
|
||||
return value.CallWithPointer(thisPtr => thisPtr);
|
||||
}
|
||||
|
||||
public override FadeOutCommand Lift(IntPtr value) {
|
||||
return new FadeOutCommand(value);
|
||||
}
|
||||
|
||||
public override FadeOutCommand Read(BigEndianStream stream) {
|
||||
return Lift(new IntPtr(stream.ReadLong()));
|
||||
}
|
||||
|
||||
public override int AllocationSize(FadeOutCommand value) {
|
||||
return 8;
|
||||
}
|
||||
|
||||
public override void Write(FadeOutCommand value, BigEndianStream stream) {
|
||||
stream.WriteLong(Lower(value).ToInt64());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public interface IHardResetCommand {
|
||||
}
|
||||
public class HardResetCommand : IHardResetCommand, IDisposable {
|
||||
protected IntPtr pointer;
|
||||
private int _wasDestroyed = 0;
|
||||
private long _callCounter = 1;
|
||||
|
||||
public HardResetCommand(IntPtr pointer) {
|
||||
this.pointer = pointer;
|
||||
}
|
||||
|
||||
~HardResetCommand() {
|
||||
Destroy();
|
||||
}
|
||||
public HardResetCommand() :
|
||||
this(
|
||||
_UniffiHelpers.RustCall( (ref UniffiRustCallStatus _status) =>
|
||||
_UniFFILib.uniffi_servicepoint_binding_uniffi_fn_constructor_hardresetcommand_new( ref _status)
|
||||
)) {}
|
||||
|
||||
protected void FreeRustArcPtr() {
|
||||
_UniffiHelpers.RustCall((ref UniffiRustCallStatus status) => {
|
||||
_UniFFILib.uniffi_servicepoint_binding_uniffi_fn_free_hardresetcommand(this.pointer, ref status);
|
||||
});
|
||||
}
|
||||
|
||||
protected IntPtr CloneRustArcPtr() {
|
||||
return _UniffiHelpers.RustCall((ref UniffiRustCallStatus status) => {
|
||||
return _UniFFILib.uniffi_servicepoint_binding_uniffi_fn_clone_hardresetcommand(this.pointer, ref status);
|
||||
});
|
||||
}
|
||||
|
||||
public void Destroy()
|
||||
{
|
||||
// Only allow a single call to this method.
|
||||
if (Interlocked.CompareExchange(ref _wasDestroyed, 1, 0) == 0)
|
||||
{
|
||||
// This decrement always matches the initial count of 1 given at creation time.
|
||||
if (Interlocked.Decrement(ref _callCounter) == 0)
|
||||
{
|
||||
FreeRustArcPtr();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Destroy();
|
||||
GC.SuppressFinalize(this); // Suppress finalization to avoid unnecessary GC overhead.
|
||||
}
|
||||
|
||||
private void IncrementCallCounter()
|
||||
{
|
||||
// Check and increment the call counter, to keep the object alive.
|
||||
// This needs a compare-and-set retry loop in case of concurrent updates.
|
||||
long count;
|
||||
do
|
||||
{
|
||||
count = Interlocked.Read(ref _callCounter);
|
||||
if (count == 0L) throw new System.ObjectDisposedException(String.Format("'{0}' object has already been destroyed", this.GetType().Name));
|
||||
if (count == long.MaxValue) throw new System.OverflowException(String.Format("'{0}' call counter would overflow", this.GetType().Name));
|
||||
|
||||
} while (Interlocked.CompareExchange(ref _callCounter, count + 1, count) != count);
|
||||
}
|
||||
|
||||
private void DecrementCallCounter()
|
||||
{
|
||||
// This decrement always matches the increment we performed above.
|
||||
if (Interlocked.Decrement(ref _callCounter) == 0) {
|
||||
FreeRustArcPtr();
|
||||
}
|
||||
}
|
||||
|
||||
internal void CallWithPointer(Action<IntPtr> action)
|
||||
{
|
||||
IncrementCallCounter();
|
||||
try {
|
||||
action(CloneRustArcPtr());
|
||||
}
|
||||
finally {
|
||||
DecrementCallCounter();
|
||||
}
|
||||
}
|
||||
|
||||
internal T CallWithPointer<T>(Func<IntPtr, T> func)
|
||||
{
|
||||
IncrementCallCounter();
|
||||
try {
|
||||
return func(CloneRustArcPtr());
|
||||
}
|
||||
finally {
|
||||
DecrementCallCounter();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
class FfiConverterTypeHardResetCommand: FfiConverter<HardResetCommand, IntPtr> {
|
||||
public static FfiConverterTypeHardResetCommand INSTANCE = new FfiConverterTypeHardResetCommand();
|
||||
|
||||
|
||||
public override IntPtr Lower(HardResetCommand value) {
|
||||
return value.CallWithPointer(thisPtr => thisPtr);
|
||||
}
|
||||
|
||||
public override HardResetCommand Lift(IntPtr value) {
|
||||
return new HardResetCommand(value);
|
||||
}
|
||||
|
||||
public override HardResetCommand Read(BigEndianStream stream) {
|
||||
return Lift(new IntPtr(stream.ReadLong()));
|
||||
}
|
||||
|
||||
public override int AllocationSize(HardResetCommand value) {
|
||||
return 8;
|
||||
}
|
||||
|
||||
public override void Write(HardResetCommand value, BigEndianStream stream) {
|
||||
stream.WriteLong(Lower(value).ToInt64());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public record Constants (
|
||||
ulong @tileSize,
|
||||
ulong @tileWidth,
|
||||
|
@ -4056,6 +4666,16 @@ class FfiConverterTypeServicePointError : FfiConverterRustBuffer<ServicePointExc
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Typealias from the type name used in the UDL file to the builtin type. This
|
||||
* is needed because the UDL type name is used in function/method signatures.
|
||||
* It's also what we have an external type that references a custom type.
|
||||
*/
|
||||
|
||||
|
||||
#pragma warning restore 8625
|
||||
public static class ServicepointBindingUniffiMethods {
|
||||
public static Constants GetConstants() {
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 022106e2dba704a58f9e6f97b1db7c9ce38005ab
|
||||
Subproject commit 635fef024437d29b922999fe1d8bd7e6e30524a9
|
Loading…
Reference in a new issue