44// To update this file, just rebuild your project or run
55// `swift package bridge-js`.
66
7+ export const PrecisionValues = {
8+ Rough : 0.1 ,
9+ Fine : 0.001 ,
10+ } ;
11+
712export async function createInstantiator ( options , swift ) {
813 let instance ;
914 let memory ;
@@ -184,6 +189,35 @@ export async function createInstantiator(options, swift) {
184189 }
185190 } ) ;
186191 } ;
192+ const __bjs_createMeasurementHelpers = ( ) => {
193+ return ( tmpParamInts , tmpParamF32s , tmpParamF64s , tmpParamPointers , tmpRetPointers , textEncoder , swift , enumHelpers ) => ( {
194+ lower : ( value ) => {
195+ tmpParamF64s . push ( value . value ) ;
196+ tmpParamF32s . push ( Math . fround ( value . precision ) ) ;
197+ const isSome = value . optionalPrecision != null ;
198+ if ( isSome ) {
199+ tmpParamF32s . push ( Math . fround ( value . optionalPrecision ) ) ;
200+ } else {
201+ tmpParamF32s . push ( 0.0 ) ;
202+ }
203+ tmpParamInts . push ( isSome ? 1 : 0 ) ;
204+ return { cleanup : undefined } ;
205+ } ,
206+ raise : ( tmpRetStrings , tmpRetInts , tmpRetF32s , tmpRetF64s , tmpRetPointers ) => {
207+ const isSome = tmpRetInts . pop ( ) ;
208+ let optional ;
209+ if ( isSome ) {
210+ const value = tmpRetF32s . pop ( ) ;
211+ optional = value ;
212+ } else {
213+ optional = null ;
214+ }
215+ const value1 = tmpRetF32s . pop ( ) ;
216+ const f64 = tmpRetF64s . pop ( ) ;
217+ return { value : f64 , precision : value1 , optionalPrecision : optional } ;
218+ }
219+ } ) ;
220+ } ;
187221 const __bjs_createConfigStructHelpers = ( ) => {
188222 return ( tmpParamInts , tmpParamF32s , tmpParamF64s , tmpParamPointers , tmpRetPointers , textEncoder , swift , enumHelpers ) => ( {
189223 lower : ( value ) => {
@@ -315,6 +349,17 @@ export async function createInstantiator(options, swift) {
315349 const value = structHelpers . Session . raise ( tmpRetStrings , tmpRetInts , tmpRetF32s , tmpRetF64s , tmpRetPointers ) ;
316350 return swift . memory . retain ( value ) ;
317351 }
352+ bjs [ "swift_js_struct_lower_Measurement" ] = function ( objectId ) {
353+ const { cleanup : cleanup } = structHelpers . Measurement . lower ( swift . memory . getObject ( objectId ) ) ;
354+ if ( cleanup ) {
355+ return tmpStructCleanups . push ( cleanup ) ;
356+ }
357+ return 0 ;
358+ }
359+ bjs [ "swift_js_struct_raise_Measurement" ] = function ( ) {
360+ const value = structHelpers . Measurement . raise ( tmpRetStrings , tmpRetInts , tmpRetF32s , tmpRetF64s , tmpRetPointers ) ;
361+ return swift . memory . retain ( value ) ;
362+ }
318363 bjs [ "swift_js_struct_lower_ConfigStruct" ] = function ( objectId ) {
319364 const { cleanup : cleanup } = structHelpers . ConfigStruct . lower ( swift . memory . getObject ( objectId ) ) ;
320365 if ( cleanup ) {
@@ -498,6 +543,9 @@ export async function createInstantiator(options, swift) {
498543 const SessionHelpers = __bjs_createSessionHelpers ( ) ( tmpParamInts , tmpParamF32s , tmpParamF64s , tmpParamPointers , tmpRetPointers , textEncoder , swift , enumHelpers ) ;
499544 structHelpers . Session = SessionHelpers ;
500545
546+ const MeasurementHelpers = __bjs_createMeasurementHelpers ( ) ( tmpParamInts , tmpParamF32s , tmpParamF64s , tmpParamPointers , tmpRetPointers , textEncoder , swift , enumHelpers ) ;
547+ structHelpers . Measurement = MeasurementHelpers ;
548+
501549 const ConfigStructHelpers = __bjs_createConfigStructHelpers ( ) ( tmpParamInts , tmpParamF32s , tmpParamF64s , tmpParamPointers , tmpRetPointers , textEncoder , swift , enumHelpers ) ;
502550 structHelpers . ConfigStruct = ConfigStructHelpers ;
503551
@@ -510,6 +558,7 @@ export async function createInstantiator(options, swift) {
510558 if ( cleanup ) { cleanup ( ) ; }
511559 return structValue ;
512560 } ,
561+ Precision : PrecisionValues ,
513562 DataPoint : {
514563 init : function ( x , y , label , optCount , optFlag ) {
515564 const labelBytes = textEncoder . encode ( label ) ;
0 commit comments