diff --git a/crates/servicepoint_binding_uniffi/libraries/csharp/ServicePoint/servicepoint_binding_uniffi.cs b/crates/servicepoint_binding_uniffi/libraries/csharp/ServicePoint/servicepoint_binding_uniffi.cs index f9a6975..a9077dd 100644 --- a/crates/servicepoint_binding_uniffi/libraries/csharp/ServicePoint/servicepoint_binding_uniffi.cs +++ b/crates/servicepoint_binding_uniffi/libraries/csharp/ServicePoint/servicepoint_binding_uniffi.cs @@ -751,6 +751,10 @@ static class _UniFFILib { public static extern ulong uniffi_servicepoint_binding_uniffi_fn_method_cp437grid_width(Cp437GridSafeHandle @ptr,ref RustCallStatus _uniffi_out_err ); + [DllImport("servicepoint_binding_uniffi")] + public static extern RustBuffer uniffi_servicepoint_binding_uniffi_fn_func_get_constants(ref RustCallStatus _uniffi_out_err + ); + [DllImport("servicepoint_binding_uniffi")] public static extern RustBuffer ffi_servicepoint_binding_uniffi_rustbuffer_alloc(int @size,ref RustCallStatus _uniffi_out_err ); @@ -979,6 +983,10 @@ static class _UniFFILib { public static extern void ffi_servicepoint_binding_uniffi_rust_future_complete_void(IntPtr @handle,ref RustCallStatus _uniffi_out_err ); + [DllImport("servicepoint_binding_uniffi")] + public static extern ushort uniffi_servicepoint_binding_uniffi_checksum_func_get_constants( + ); + [DllImport("servicepoint_binding_uniffi")] public static extern ushort uniffi_servicepoint_binding_uniffi_checksum_method_bitvec_copy_raw( ); @@ -1281,6 +1289,12 @@ static class _UniFFILib { } static void uniffiCheckApiChecksums() { + { + var checksum = _UniFFILib.uniffi_servicepoint_binding_uniffi_checksum_func_get_constants(); + if (checksum != 41584) { + throw new UniffiContractChecksumException($"ServicePoint: uniffi bindings expected function `uniffi_servicepoint_binding_uniffi_checksum_func_get_constants` checksum `41584`, library returned `{checksum}`"); + } + } { var checksum = _UniFFILib.uniffi_servicepoint_binding_uniffi_checksum_method_bitvec_copy_raw(); if (checksum != 12617) { @@ -2902,6 +2916,52 @@ class FfiConverterTypeCp437Grid: FfiConverter { +public record Constants ( + ulong @tileSize, + ulong @tileWidth, + ulong @tileHeight, + ulong @pixelWidth, + ulong @pixelHeight, + ulong @pixelCount +) { +} + +class FfiConverterTypeConstants: FfiConverterRustBuffer { + public static FfiConverterTypeConstants INSTANCE = new FfiConverterTypeConstants(); + + public override Constants Read(BigEndianStream stream) { + return new Constants( + @tileSize: FfiConverterUInt64.INSTANCE.Read(stream), + @tileWidth: FfiConverterUInt64.INSTANCE.Read(stream), + @tileHeight: FfiConverterUInt64.INSTANCE.Read(stream), + @pixelWidth: FfiConverterUInt64.INSTANCE.Read(stream), + @pixelHeight: FfiConverterUInt64.INSTANCE.Read(stream), + @pixelCount: FfiConverterUInt64.INSTANCE.Read(stream) + ); + } + + public override int AllocationSize(Constants value) { + return + FfiConverterUInt64.INSTANCE.AllocationSize(value.@tileSize) + + FfiConverterUInt64.INSTANCE.AllocationSize(value.@tileWidth) + + FfiConverterUInt64.INSTANCE.AllocationSize(value.@tileHeight) + + FfiConverterUInt64.INSTANCE.AllocationSize(value.@pixelWidth) + + FfiConverterUInt64.INSTANCE.AllocationSize(value.@pixelHeight) + + FfiConverterUInt64.INSTANCE.AllocationSize(value.@pixelCount); + } + + public override void Write(Constants value, BigEndianStream stream) { + FfiConverterUInt64.INSTANCE.Write(value.@tileSize, stream); + FfiConverterUInt64.INSTANCE.Write(value.@tileWidth, stream); + FfiConverterUInt64.INSTANCE.Write(value.@tileHeight, stream); + FfiConverterUInt64.INSTANCE.Write(value.@pixelWidth, stream); + FfiConverterUInt64.INSTANCE.Write(value.@pixelHeight, stream); + FfiConverterUInt64.INSTANCE.Write(value.@pixelCount, stream); + } +} + + + public class CharGridException: UniffiException { @@ -3133,5 +3193,12 @@ class FfiConverterTypeServicePointException : FfiConverterRustBuffer + _UniFFILib.uniffi_servicepoint_binding_uniffi_fn_func_get_constants( ref _status) +)); + } + } diff --git a/crates/servicepoint_binding_uniffi/libraries/ruby/lib/servicepoint_binding_uniffi.rb b/crates/servicepoint_binding_uniffi/libraries/ruby/lib/servicepoint_binding_uniffi.rb index b66f128..1e7aac7 100644 --- a/crates/servicepoint_binding_uniffi/libraries/ruby/lib/servicepoint_binding_uniffi.rb +++ b/crates/servicepoint_binding_uniffi/libraries/ruby/lib/servicepoint_binding_uniffi.rb @@ -126,6 +126,21 @@ end end end + # The Record type Constants. + + def self.alloc_from_TypeConstants(v) + RustBuffer.allocWithBuilder do |builder| + builder.write_TypeConstants(v) + return builder.finalize + end + end + + def consumeIntoTypeConstants + consumeWithStream do |stream| + return stream.readTypeConstants + end + end + # The Enum type CompressionCode. @@ -274,6 +289,19 @@ class RustBufferStream return Cp437Grid._uniffi_allocate(pointer) end + # The Record type Constants. + + def readTypeConstants + Constants.new( + readU64, + readU64, + readU64, + readU64, + readU64, + readU64 + ) + end + @@ -478,6 +506,17 @@ class RustBufferBuilder pack_into(8, 'Q>', pointer.address) end + # The Record type Constants. + + def write_TypeConstants(v) + self.write_U64(v.tile_size) + self.write_U64(v.tile_width) + self.write_U64(v.tile_height) + self.write_U64(v.pixel_width) + self.write_U64(v.pixel_height) + self.write_U64(v.pixel_count) + end + # The Enum type CompressionCode. @@ -930,6 +969,9 @@ module UniFFILib attach_function :uniffi_servicepoint_binding_uniffi_fn_method_cp437grid_width, [:pointer, RustCallStatus.by_ref], :uint64 + attach_function :uniffi_servicepoint_binding_uniffi_fn_func_get_constants, + [RustCallStatus.by_ref], + RustBuffer.by_value attach_function :ffi_servicepoint_binding_uniffi_rustbuffer_alloc, [:int32, RustCallStatus.by_ref], RustBuffer.by_value @@ -942,6 +984,9 @@ module UniFFILib attach_function :ffi_servicepoint_binding_uniffi_rustbuffer_reserve, [RustBuffer.by_value, :int32, RustCallStatus.by_ref], RustBuffer.by_value + attach_function :uniffi_servicepoint_binding_uniffi_checksum_func_get_constants, + [RustCallStatus.by_ref], + :uint16 attach_function :uniffi_servicepoint_binding_uniffi_checksum_method_bitvec_copy_raw, [RustCallStatus.by_ref], :uint16 @@ -1183,6 +1228,52 @@ end + # Record type Constants +class Constants + attr_reader :tile_size, :tile_width, :tile_height, :pixel_width, :pixel_height, :pixel_count + + def initialize(tile_size, tile_width, tile_height, pixel_width, pixel_height, pixel_count) + @tile_size = tile_size + @tile_width = tile_width + @tile_height = tile_height + @pixel_width = pixel_width + @pixel_height = pixel_height + @pixel_count = pixel_count + end + + def ==(other) + if @tile_size != other.tile_size + return false + end + if @tile_width != other.tile_width + return false + end + if @tile_height != other.tile_height + return false + end + if @pixel_width != other.pixel_width + return false + end + if @pixel_height != other.pixel_height + return false + end + if @pixel_count != other.pixel_count + return false + end + + true + end +end + + + + + +def self.get_constants() + result = ServicepointBindingUniffi.rust_call(:uniffi_servicepoint_binding_uniffi_fn_func_get_constants,) + return result.consumeIntoTypeConstants +end + diff --git a/crates/servicepoint_binding_uniffi/src/constants.rs b/crates/servicepoint_binding_uniffi/src/constants.rs new file mode 100644 index 0000000..be89a9c --- /dev/null +++ b/crates/servicepoint_binding_uniffi/src/constants.rs @@ -0,0 +1,21 @@ +#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug, uniffi::Record)] +pub struct Constants { + pub tile_size: u64, + pub tile_width: u64, + pub tile_height: u64, + pub pixel_width: u64, + pub pixel_height: u64, + pub pixel_count: u64, +} + +#[uniffi::export] +fn get_constants() -> Constants { +Constants { + tile_size: servicepoint::TILE_SIZE as u64, + tile_width: servicepoint::TILE_WIDTH as u64, + tile_height: servicepoint::TILE_HEIGHT as u64, + pixel_width: servicepoint::PIXEL_WIDTH as u64, + pixel_height: servicepoint::PIXEL_HEIGHT as u64, + pixel_count: servicepoint::PIXEL_COUNT as u64, + } +} diff --git a/crates/servicepoint_binding_uniffi/src/lib.rs b/crates/servicepoint_binding_uniffi/src/lib.rs index 29564aa..1c932e6 100644 --- a/crates/servicepoint_binding_uniffi/src/lib.rs +++ b/crates/servicepoint_binding_uniffi/src/lib.rs @@ -9,3 +9,4 @@ mod compression_code; mod connection; mod cp437_grid; mod errors; +mod constants;