nova_ta 0.1.2-x64-mingw-ucrt

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. checksums.yaml +7 -0
  2. data/lib/nova_ta.dll +0 -0
  3. data/lib/nova_ta.rb +1374 -0
  4. metadata +54 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: d50f81fb271f3ed8f77a77b4e7ddb02e48d5c416acb13df00617019769f85f7a
4
+ data.tar.gz: 788afdcf1ac99aa5ce38dbebcb5316cb7924cf60113dae0f5b43ce8af3809080
5
+ SHA512:
6
+ metadata.gz: 624a1cf5c6f394b7bc1ea839ee3c0626c6a7e231b90a788be87c742a5737452267f741e463569f4f13f2f20636add3f5d43b676e9d750db923ea62034ab70365
7
+ data.tar.gz: ad5f4444a19763d77053d684ab1f68177917cbc058f8dc1d788717223604673449e35a2999d3a80abba85d3867e406b1b5d5098a6efac1c99c8af1b8e0ca7034
data/lib/nova_ta.dll ADDED
Binary file
data/lib/nova_ta.rb ADDED
@@ -0,0 +1,1374 @@
1
+ # This file was autogenerated by some hot garbage in the `uniffi` crate.
2
+ # Trust me, you don't want to mess with it!
3
+
4
+ # Common helper code.
5
+ #
6
+ # Ideally this would live in a separate .rb file where it can be unittested etc
7
+ # in isolation, and perhaps even published as a re-useable package.
8
+ #
9
+ # However, it's important that the details of how this helper code works (e.g. the
10
+ # way that different builtin types are passed across the FFI) exactly match what's
11
+ # expected by the rust code on the other side of the interface. In practice right
12
+ # now that means coming from the exact some version of `uniffi` that was used to
13
+ # compile the rust component. The easiest way to ensure this is to bundle the Ruby
14
+ # helpers directly inline like we're doing here.
15
+
16
+ require 'ffi'
17
+
18
+
19
+ module NovaTa
20
+ def self.uniffi_in_range(i, type_name, min, max)
21
+ raise TypeError, "no implicit conversion of #{i} into Integer" unless i.respond_to?(:to_int)
22
+ i = i.to_int
23
+ raise RangeError, "#{type_name} requires #{min} <= value < #{max}" unless (min <= i && i < max)
24
+ i
25
+ end
26
+
27
+ def self.uniffi_utf8(v)
28
+ raise TypeError, "no implicit conversion of #{v} into String" unless v.respond_to?(:to_str)
29
+ v = v.to_str.encode(Encoding::UTF_8)
30
+ raise Encoding::InvalidByteSequenceError, "not a valid UTF-8 encoded string" unless v.valid_encoding?
31
+ v
32
+ end
33
+
34
+ def self.uniffi_bytes(v)
35
+ raise TypeError, "no implicit conversion of #{v} into String" unless v.respond_to?(:to_str)
36
+ v.to_str
37
+ end
38
+
39
+ class RustBuffer < FFI::Struct
40
+ layout :capacity, :uint64,
41
+ :len, :uint64,
42
+ :data, :pointer
43
+
44
+ def self.alloc(size)
45
+ return NovaTa.rust_call(:ffi_nova_ta_rustbuffer_alloc, size)
46
+ end
47
+
48
+ def self.reserve(rbuf, additional)
49
+ return NovaTa.rust_call(:ffi_nova_ta_rustbuffer_reserve, rbuf, additional)
50
+ end
51
+
52
+ def free
53
+ NovaTa.rust_call(:ffi_nova_ta_rustbuffer_free, self)
54
+ end
55
+
56
+ def capacity
57
+ self[:capacity]
58
+ end
59
+
60
+ def len
61
+ self[:len]
62
+ end
63
+
64
+ def len=(value)
65
+ self[:len] = value
66
+ end
67
+
68
+ def data
69
+ self[:data]
70
+ end
71
+
72
+ def to_s
73
+ "RustBuffer(capacity=#{capacity}, len=#{len}, data=#{data.read_bytes len})"
74
+ end
75
+
76
+ # The allocated buffer will be automatically freed if an error occurs, ensuring that
77
+ # we don't accidentally leak it.
78
+ def self.allocWithBuilder
79
+ builder = RustBufferBuilder.new
80
+
81
+ begin
82
+ yield builder
83
+ rescue => e
84
+ builder.discard
85
+ raise e
86
+ end
87
+ end
88
+
89
+ # The RustBuffer will be freed once the context-manager exits, ensuring that we don't
90
+ # leak it even if an error occurs.
91
+ def consumeWithStream
92
+ stream = RustBufferStream.new self
93
+
94
+ yield stream
95
+
96
+ raise RuntimeError, 'junk data left in buffer after consuming' if stream.remaining != 0
97
+ ensure
98
+ free
99
+ end# The primitive String type.
100
+
101
+ def self.allocFromString(value)
102
+ RustBuffer.allocWithBuilder do |builder|
103
+ builder.write value.encode('utf-8')
104
+ return builder.finalize
105
+ end
106
+ end
107
+
108
+ def consumeIntoString
109
+ consumeWithStream do |stream|
110
+ return stream.read(stream.remaining).force_encoding(Encoding::UTF_8)
111
+ end
112
+ end
113
+
114
+
115
+
116
+
117
+ end
118
+
119
+ module UniFFILib
120
+ class ForeignBytes < FFI::Struct
121
+ layout :len, :int32,
122
+ :data, :pointer
123
+
124
+ def len
125
+ self[:len]
126
+ end
127
+
128
+ def data
129
+ self[:data]
130
+ end
131
+
132
+ def to_s
133
+ "ForeignBytes(len=#{len}, data=#{data.read_bytes(len)})"
134
+ end
135
+ end
136
+ end
137
+
138
+ private_constant :UniFFILib
139
+
140
+ # Helper for structured reading of values from a RustBuffer.
141
+ class RustBufferStream
142
+
143
+ def initialize(rbuf)
144
+ @rbuf = rbuf
145
+ @offset = 0
146
+ end
147
+
148
+ def remaining
149
+ @rbuf.len - @offset
150
+ end
151
+
152
+ def read(size)
153
+ raise InternalError, 'read past end of rust buffer' if @offset + size > @rbuf.len
154
+
155
+ data = @rbuf.data.get_bytes @offset, size
156
+
157
+ @offset += size
158
+
159
+ data
160
+ end
161
+
162
+ def readU32
163
+ unpack_from 4, 'L>'
164
+ end
165
+
166
+ def readU64
167
+ unpack_from 8, 'Q>'
168
+ end
169
+
170
+ def readF64
171
+ unpack_from 8, 'G'
172
+ end
173
+
174
+ def readBool
175
+ v = unpack_from 1, 'c'
176
+
177
+ return false if v == 0
178
+ return true if v == 1
179
+
180
+ raise InternalError, 'Unexpected byte for Boolean type'
181
+ end
182
+
183
+ def readString
184
+ size = unpack_from 4, 'l>'
185
+
186
+ raise InternalError, 'Unexpected negative string length' if size.negative?
187
+
188
+ read(size).force_encoding(Encoding::UTF_8)
189
+ end
190
+
191
+ # The Object type Alma.
192
+
193
+ def readTypeAlma
194
+ handle = unpack_from 8, 'Q>'
195
+ return Alma.uniffi_allocate(handle)
196
+ end
197
+
198
+ # The Object type Cti.
199
+
200
+ def readTypeCti
201
+ handle = unpack_from 8, 'Q>'
202
+ return Cti.uniffi_allocate(handle)
203
+ end
204
+
205
+ # The Object type Gaussian.
206
+
207
+ def readTypeGaussian
208
+ handle = unpack_from 8, 'Q>'
209
+ return Gaussian.uniffi_allocate(handle)
210
+ end
211
+
212
+ # The Object type Kama.
213
+
214
+ def readTypeKama
215
+ handle = unpack_from 8, 'Q>'
216
+ return Kama.uniffi_allocate(handle)
217
+ end
218
+
219
+ # The Object type Ker.
220
+
221
+ def readTypeKer
222
+ handle = unpack_from 8, 'Q>'
223
+ return Ker.uniffi_allocate(handle)
224
+ end
225
+
226
+ # The Object type LinearWma.
227
+
228
+ def readTypeLinearWma
229
+ handle = unpack_from 8, 'Q>'
230
+ return LinearWma.uniffi_allocate(handle)
231
+ end
232
+
233
+ # The Object type Lsma.
234
+
235
+ def readTypeLsma
236
+ handle = unpack_from 8, 'Q>'
237
+ return Lsma.uniffi_allocate(handle)
238
+ end
239
+
240
+ # The Object type UltimateSmoother.
241
+
242
+ def readTypeUltimateSmoother
243
+ handle = unpack_from 8, 'Q>'
244
+ return UltimateSmoother.uniffi_allocate(handle)
245
+ end
246
+
247
+
248
+
249
+
250
+
251
+ # The Error type NovaError
252
+
253
+ def readTypeNovaError
254
+ variant = unpack_from 4, 'l>'
255
+
256
+ if variant == 1
257
+ return NovaError::Never.new(
258
+ readString()
259
+ )
260
+ end
261
+ if variant == 2
262
+ return NovaError::InvalidPeriod.new(
263
+ readString()
264
+ )
265
+ end
266
+ if variant == 3
267
+ return NovaError::InvalidInput.new(
268
+ readString()
269
+ )
270
+ end
271
+ if variant == 4
272
+ return NovaError::WindowIdx.new(
273
+ readString()
274
+ )
275
+ end
276
+ if variant == 5
277
+ return NovaError::Number.new(
278
+ readString()
279
+ )
280
+ end
281
+
282
+ raise InternalError, 'Unexpected variant tag for TypeNovaError'
283
+ end
284
+
285
+
286
+
287
+
288
+ def unpack_from(size, format)
289
+ raise InternalError, 'read past end of rust buffer' if @offset + size > @rbuf.len
290
+
291
+ value = @rbuf.data.get_bytes(@offset, size).unpack format
292
+
293
+ @offset += size
294
+
295
+ # TODO: verify this
296
+ raise 'more than one element!!!' if value.size > 1
297
+
298
+ value[0]
299
+ end
300
+ end
301
+
302
+ private_constant :RustBufferStream
303
+
304
+ # Helper for structured writing of values into a RustBuffer.
305
+ class RustBufferBuilder
306
+ def initialize
307
+ @rust_buf = RustBuffer.alloc 16
308
+ @rust_buf.len = 0
309
+ end
310
+
311
+ def finalize
312
+ rbuf = @rust_buf
313
+
314
+ @rust_buf = nil
315
+
316
+ rbuf
317
+ end
318
+
319
+ def discard
320
+ return if @rust_buf.nil?
321
+
322
+ rbuf = finalize
323
+ rbuf.free
324
+ end
325
+
326
+ def write(value)
327
+ reserve(value.bytes.size) do
328
+ @rust_buf.data.put_array_of_char @rust_buf.len, value.bytes
329
+ end
330
+ end
331
+
332
+ def write_U32(v)
333
+ v = NovaTa::uniffi_in_range(v, "u32", 0, 2**32)
334
+ pack_into(4, 'L>', v)
335
+ end
336
+
337
+ def write_U64(v)
338
+ v = NovaTa::uniffi_in_range(v, "u64", 0, 2**64)
339
+ pack_into(8, 'Q>', v)
340
+ end
341
+
342
+ def write_F64(v)
343
+ pack_into(8, 'G', v)
344
+ end
345
+
346
+ def write_Bool(v)
347
+ pack_into(1, 'c', v ? 1 : 0)
348
+ end
349
+
350
+ def write_String(v)
351
+ v = NovaTa::uniffi_utf8(v)
352
+ pack_into 4, 'l>', v.bytes.size
353
+ write v
354
+ end
355
+
356
+ # The Object type Alma.
357
+
358
+ def write_TypeAlma(obj)
359
+ handle = Alma.uniffi_lower obj
360
+ pack_into(8, 'Q>', handle)
361
+ end
362
+
363
+ # The Object type Cti.
364
+
365
+ def write_TypeCti(obj)
366
+ handle = Cti.uniffi_lower obj
367
+ pack_into(8, 'Q>', handle)
368
+ end
369
+
370
+ # The Object type Gaussian.
371
+
372
+ def write_TypeGaussian(obj)
373
+ handle = Gaussian.uniffi_lower obj
374
+ pack_into(8, 'Q>', handle)
375
+ end
376
+
377
+ # The Object type Kama.
378
+
379
+ def write_TypeKama(obj)
380
+ handle = Kama.uniffi_lower obj
381
+ pack_into(8, 'Q>', handle)
382
+ end
383
+
384
+ # The Object type Ker.
385
+
386
+ def write_TypeKer(obj)
387
+ handle = Ker.uniffi_lower obj
388
+ pack_into(8, 'Q>', handle)
389
+ end
390
+
391
+ # The Object type LinearWma.
392
+
393
+ def write_TypeLinearWma(obj)
394
+ handle = LinearWma.uniffi_lower obj
395
+ pack_into(8, 'Q>', handle)
396
+ end
397
+
398
+ # The Object type Lsma.
399
+
400
+ def write_TypeLsma(obj)
401
+ handle = Lsma.uniffi_lower obj
402
+ pack_into(8, 'Q>', handle)
403
+ end
404
+
405
+ # The Object type UltimateSmoother.
406
+
407
+ def write_TypeUltimateSmoother(obj)
408
+ handle = UltimateSmoother.uniffi_lower obj
409
+ pack_into(8, 'Q>', handle)
410
+ end
411
+
412
+
413
+
414
+
415
+
416
+ private
417
+
418
+ def reserve(num_bytes)
419
+ if @rust_buf.len + num_bytes > @rust_buf.capacity
420
+ @rust_buf = RustBuffer.reserve(@rust_buf, num_bytes)
421
+ end
422
+
423
+ yield
424
+
425
+ @rust_buf.len += num_bytes
426
+ end
427
+
428
+ def pack_into(size, format, value)
429
+ reserve(size) do
430
+ @rust_buf.data.put_array_of_char @rust_buf.len, [value].pack(format).bytes
431
+ end
432
+ end
433
+ end
434
+
435
+ private_constant :RustBufferBuilder
436
+
437
+ # Error definitions
438
+ class RustCallStatus < FFI::Struct
439
+ layout :code, :int8,
440
+ :error_buf, RustBuffer
441
+
442
+ def code
443
+ self[:code]
444
+ end
445
+
446
+ def error_buf
447
+ self[:error_buf]
448
+ end
449
+
450
+ def to_s
451
+ "RustCallStatus(code=#{self[:code]})"
452
+ end
453
+ end
454
+
455
+ # These match the values from the uniffi::rustcalls module
456
+ CALL_SUCCESS = 0
457
+ CALL_ERROR = 1
458
+ CALL_PANIC = 2
459
+
460
+
461
+ class NovaError
462
+ Never = Class.new StandardError
463
+ InvalidPeriod = Class.new StandardError
464
+ InvalidInput = Class.new StandardError
465
+ WindowIdx = Class.new StandardError
466
+ Number = Class.new StandardError
467
+
468
+ end
469
+
470
+
471
+ # Map error modules to the RustBuffer method name that reads them
472
+ ERROR_MODULE_TO_READER_METHOD = {
473
+
474
+ NovaError => :readTypeNovaError,
475
+
476
+ }
477
+
478
+ private_constant :ERROR_MODULE_TO_READER_METHOD, :CALL_SUCCESS, :CALL_ERROR, :CALL_PANIC,
479
+ :RustCallStatus
480
+
481
+ def self.consume_buffer_into_error(error_module, rust_buffer)
482
+ rust_buffer.consumeWithStream do |stream|
483
+ reader_method = ERROR_MODULE_TO_READER_METHOD[error_module]
484
+ return stream.send(reader_method)
485
+ end
486
+ end
487
+
488
+ class InternalError < StandardError
489
+ end
490
+
491
+ def self.rust_call(fn_name, *args)
492
+ # Call a rust function
493
+ rust_call_with_error(nil, fn_name, *args)
494
+ end
495
+
496
+ def self.rust_call_with_error(error_module, fn_name, *args)
497
+ # Call a rust function and handle errors
498
+ #
499
+ # Use this when the rust function returns a Result<>. error_module must be the error_module that corresponds to that Result.
500
+
501
+
502
+ # Note: RustCallStatus.new zeroes out the struct, which is exactly what we
503
+ # want to pass to Rust (code=0, error_buf=RustBuffer(len=0, capacity=0,
504
+ # data=NULL))
505
+ status = RustCallStatus.new
506
+ args << status
507
+
508
+ result = UniFFILib.public_send(fn_name, *args)
509
+
510
+ case status.code
511
+ when CALL_SUCCESS
512
+ result
513
+ when CALL_ERROR
514
+ if error_module.nil?
515
+ status.error_buf.free
516
+ raise InternalError, "CALL_ERROR with no error_module set"
517
+ else
518
+ raise consume_buffer_into_error(error_module, status.error_buf)
519
+ end
520
+ when CALL_PANIC
521
+ # When the rust code sees a panic, it tries to construct a RustBuffer
522
+ # with the message. But if that code panics, then it just sends back
523
+ # an empty buffer.
524
+ if status.error_buf.len > 0
525
+ raise InternalError, status.error_buf.consumeIntoString()
526
+ else
527
+ raise InternalError, "Rust panic"
528
+ end
529
+ else
530
+ raise InternalError, "Unknown call status: #{status.code}"
531
+ end
532
+ end
533
+
534
+ private_class_method :consume_buffer_into_error
535
+
536
+ # This is how we find and load the dynamic library provided by the component.
537
+ # For now we just look it up by name.
538
+ module UniFFILib
539
+ extend FFI::Library
540
+
541
+
542
+ ffi_lib 'nova_ta'
543
+
544
+
545
+ attach_function :uniffi_nova_ta_fn_clone_alma,
546
+ [:uint64, RustCallStatus.by_ref],
547
+ :uint64
548
+ attach_function :uniffi_nova_ta_fn_free_alma,
549
+ [:uint64, RustCallStatus.by_ref],
550
+ :void
551
+ attach_function :uniffi_nova_ta_fn_constructor_alma_new,
552
+ [:uint64, :double, :uint32, RustCallStatus.by_ref],
553
+ :uint64
554
+ attach_function :uniffi_nova_ta_fn_method_alma_ready,
555
+ [:uint64, RustCallStatus.by_ref],
556
+ :int8
557
+ attach_function :uniffi_nova_ta_fn_method_alma_reset,
558
+ [:uint64, RustCallStatus.by_ref],
559
+ :void
560
+ attach_function :uniffi_nova_ta_fn_method_alma_update,
561
+ [:uint64, :double, RustCallStatus.by_ref],
562
+ :double
563
+ attach_function :uniffi_nova_ta_fn_clone_gaussian,
564
+ [:uint64, RustCallStatus.by_ref],
565
+ :uint64
566
+ attach_function :uniffi_nova_ta_fn_free_gaussian,
567
+ [:uint64, RustCallStatus.by_ref],
568
+ :void
569
+ attach_function :uniffi_nova_ta_fn_constructor_gaussian_new,
570
+ [:uint64, :double, RustCallStatus.by_ref],
571
+ :uint64
572
+ attach_function :uniffi_nova_ta_fn_method_gaussian_ready,
573
+ [:uint64, RustCallStatus.by_ref],
574
+ :int8
575
+ attach_function :uniffi_nova_ta_fn_method_gaussian_reset,
576
+ [:uint64, RustCallStatus.by_ref],
577
+ :void
578
+ attach_function :uniffi_nova_ta_fn_method_gaussian_update,
579
+ [:uint64, :double, RustCallStatus.by_ref],
580
+ :double
581
+ attach_function :uniffi_nova_ta_fn_clone_kama,
582
+ [:uint64, RustCallStatus.by_ref],
583
+ :uint64
584
+ attach_function :uniffi_nova_ta_fn_free_kama,
585
+ [:uint64, RustCallStatus.by_ref],
586
+ :void
587
+ attach_function :uniffi_nova_ta_fn_constructor_kama_new,
588
+ [:uint64, :uint64, :uint64, RustCallStatus.by_ref],
589
+ :uint64
590
+ attach_function :uniffi_nova_ta_fn_method_kama_ready,
591
+ [:uint64, RustCallStatus.by_ref],
592
+ :int8
593
+ attach_function :uniffi_nova_ta_fn_method_kama_reset,
594
+ [:uint64, RustCallStatus.by_ref],
595
+ :void
596
+ attach_function :uniffi_nova_ta_fn_method_kama_update,
597
+ [:uint64, :double, RustCallStatus.by_ref],
598
+ :double
599
+ attach_function :uniffi_nova_ta_fn_clone_lsma,
600
+ [:uint64, RustCallStatus.by_ref],
601
+ :uint64
602
+ attach_function :uniffi_nova_ta_fn_free_lsma,
603
+ [:uint64, RustCallStatus.by_ref],
604
+ :void
605
+ attach_function :uniffi_nova_ta_fn_constructor_lsma_new,
606
+ [:uint64, RustCallStatus.by_ref],
607
+ :uint64
608
+ attach_function :uniffi_nova_ta_fn_method_lsma_ready,
609
+ [:uint64, RustCallStatus.by_ref],
610
+ :int8
611
+ attach_function :uniffi_nova_ta_fn_method_lsma_reset,
612
+ [:uint64, RustCallStatus.by_ref],
613
+ :void
614
+ attach_function :uniffi_nova_ta_fn_method_lsma_update,
615
+ [:uint64, :double, RustCallStatus.by_ref],
616
+ :double
617
+ attach_function :uniffi_nova_ta_fn_clone_ultimatesmoother,
618
+ [:uint64, RustCallStatus.by_ref],
619
+ :uint64
620
+ attach_function :uniffi_nova_ta_fn_free_ultimatesmoother,
621
+ [:uint64, RustCallStatus.by_ref],
622
+ :void
623
+ attach_function :uniffi_nova_ta_fn_constructor_ultimatesmoother_new,
624
+ [:uint64, RustCallStatus.by_ref],
625
+ :uint64
626
+ attach_function :uniffi_nova_ta_fn_method_ultimatesmoother_ready,
627
+ [:uint64, RustCallStatus.by_ref],
628
+ :int8
629
+ attach_function :uniffi_nova_ta_fn_method_ultimatesmoother_reset,
630
+ [:uint64, RustCallStatus.by_ref],
631
+ :void
632
+ attach_function :uniffi_nova_ta_fn_method_ultimatesmoother_update,
633
+ [:uint64, :double, RustCallStatus.by_ref],
634
+ :double
635
+ attach_function :uniffi_nova_ta_fn_clone_linearwma,
636
+ [:uint64, RustCallStatus.by_ref],
637
+ :uint64
638
+ attach_function :uniffi_nova_ta_fn_free_linearwma,
639
+ [:uint64, RustCallStatus.by_ref],
640
+ :void
641
+ attach_function :uniffi_nova_ta_fn_constructor_linearwma_new,
642
+ [:uint64, RustCallStatus.by_ref],
643
+ :uint64
644
+ attach_function :uniffi_nova_ta_fn_method_linearwma_ready,
645
+ [:uint64, RustCallStatus.by_ref],
646
+ :int8
647
+ attach_function :uniffi_nova_ta_fn_method_linearwma_reset,
648
+ [:uint64, RustCallStatus.by_ref],
649
+ :void
650
+ attach_function :uniffi_nova_ta_fn_method_linearwma_update,
651
+ [:uint64, :double, RustCallStatus.by_ref],
652
+ :double
653
+ attach_function :uniffi_nova_ta_fn_clone_cti,
654
+ [:uint64, RustCallStatus.by_ref],
655
+ :uint64
656
+ attach_function :uniffi_nova_ta_fn_free_cti,
657
+ [:uint64, RustCallStatus.by_ref],
658
+ :void
659
+ attach_function :uniffi_nova_ta_fn_constructor_cti_new,
660
+ [:uint64, RustCallStatus.by_ref],
661
+ :uint64
662
+ attach_function :uniffi_nova_ta_fn_method_cti_ready,
663
+ [:uint64, RustCallStatus.by_ref],
664
+ :int8
665
+ attach_function :uniffi_nova_ta_fn_method_cti_reset,
666
+ [:uint64, RustCallStatus.by_ref],
667
+ :void
668
+ attach_function :uniffi_nova_ta_fn_method_cti_update,
669
+ [:uint64, :double, RustCallStatus.by_ref],
670
+ :double
671
+ attach_function :uniffi_nova_ta_fn_clone_ker,
672
+ [:uint64, RustCallStatus.by_ref],
673
+ :uint64
674
+ attach_function :uniffi_nova_ta_fn_free_ker,
675
+ [:uint64, RustCallStatus.by_ref],
676
+ :void
677
+ attach_function :uniffi_nova_ta_fn_constructor_ker_new,
678
+ [:uint64, RustCallStatus.by_ref],
679
+ :uint64
680
+ attach_function :uniffi_nova_ta_fn_method_ker_ready,
681
+ [:uint64, RustCallStatus.by_ref],
682
+ :int8
683
+ attach_function :uniffi_nova_ta_fn_method_ker_reset,
684
+ [:uint64, RustCallStatus.by_ref],
685
+ :void
686
+ attach_function :uniffi_nova_ta_fn_method_ker_update,
687
+ [:uint64, :double, RustCallStatus.by_ref],
688
+ :double
689
+ attach_function :ffi_nova_ta_rustbuffer_alloc,
690
+ [:uint64, RustCallStatus.by_ref],
691
+ RustBuffer.by_value
692
+ attach_function :ffi_nova_ta_rustbuffer_from_bytes,
693
+ [ForeignBytes, RustCallStatus.by_ref],
694
+ RustBuffer.by_value
695
+ attach_function :ffi_nova_ta_rustbuffer_free,
696
+ [RustBuffer.by_value, RustCallStatus.by_ref],
697
+ :void
698
+ attach_function :ffi_nova_ta_rustbuffer_reserve,
699
+ [RustBuffer.by_value, :uint64, RustCallStatus.by_ref],
700
+ RustBuffer.by_value
701
+ attach_function :uniffi_nova_ta_checksum_method_alma_ready,
702
+ [RustCallStatus.by_ref],
703
+ :uint16
704
+ attach_function :uniffi_nova_ta_checksum_method_alma_reset,
705
+ [RustCallStatus.by_ref],
706
+ :uint16
707
+ attach_function :uniffi_nova_ta_checksum_method_alma_update,
708
+ [RustCallStatus.by_ref],
709
+ :uint16
710
+ attach_function :uniffi_nova_ta_checksum_method_gaussian_ready,
711
+ [RustCallStatus.by_ref],
712
+ :uint16
713
+ attach_function :uniffi_nova_ta_checksum_method_gaussian_reset,
714
+ [RustCallStatus.by_ref],
715
+ :uint16
716
+ attach_function :uniffi_nova_ta_checksum_method_gaussian_update,
717
+ [RustCallStatus.by_ref],
718
+ :uint16
719
+ attach_function :uniffi_nova_ta_checksum_method_kama_ready,
720
+ [RustCallStatus.by_ref],
721
+ :uint16
722
+ attach_function :uniffi_nova_ta_checksum_method_kama_reset,
723
+ [RustCallStatus.by_ref],
724
+ :uint16
725
+ attach_function :uniffi_nova_ta_checksum_method_kama_update,
726
+ [RustCallStatus.by_ref],
727
+ :uint16
728
+ attach_function :uniffi_nova_ta_checksum_method_lsma_ready,
729
+ [RustCallStatus.by_ref],
730
+ :uint16
731
+ attach_function :uniffi_nova_ta_checksum_method_lsma_reset,
732
+ [RustCallStatus.by_ref],
733
+ :uint16
734
+ attach_function :uniffi_nova_ta_checksum_method_lsma_update,
735
+ [RustCallStatus.by_ref],
736
+ :uint16
737
+ attach_function :uniffi_nova_ta_checksum_method_ultimatesmoother_ready,
738
+ [RustCallStatus.by_ref],
739
+ :uint16
740
+ attach_function :uniffi_nova_ta_checksum_method_ultimatesmoother_reset,
741
+ [RustCallStatus.by_ref],
742
+ :uint16
743
+ attach_function :uniffi_nova_ta_checksum_method_ultimatesmoother_update,
744
+ [RustCallStatus.by_ref],
745
+ :uint16
746
+ attach_function :uniffi_nova_ta_checksum_method_linearwma_ready,
747
+ [RustCallStatus.by_ref],
748
+ :uint16
749
+ attach_function :uniffi_nova_ta_checksum_method_linearwma_reset,
750
+ [RustCallStatus.by_ref],
751
+ :uint16
752
+ attach_function :uniffi_nova_ta_checksum_method_linearwma_update,
753
+ [RustCallStatus.by_ref],
754
+ :uint16
755
+ attach_function :uniffi_nova_ta_checksum_method_cti_ready,
756
+ [RustCallStatus.by_ref],
757
+ :uint16
758
+ attach_function :uniffi_nova_ta_checksum_method_cti_reset,
759
+ [RustCallStatus.by_ref],
760
+ :uint16
761
+ attach_function :uniffi_nova_ta_checksum_method_cti_update,
762
+ [RustCallStatus.by_ref],
763
+ :uint16
764
+ attach_function :uniffi_nova_ta_checksum_method_ker_ready,
765
+ [RustCallStatus.by_ref],
766
+ :uint16
767
+ attach_function :uniffi_nova_ta_checksum_method_ker_reset,
768
+ [RustCallStatus.by_ref],
769
+ :uint16
770
+ attach_function :uniffi_nova_ta_checksum_method_ker_update,
771
+ [RustCallStatus.by_ref],
772
+ :uint16
773
+ attach_function :uniffi_nova_ta_checksum_constructor_alma_new,
774
+ [RustCallStatus.by_ref],
775
+ :uint16
776
+ attach_function :uniffi_nova_ta_checksum_constructor_gaussian_new,
777
+ [RustCallStatus.by_ref],
778
+ :uint16
779
+ attach_function :uniffi_nova_ta_checksum_constructor_kama_new,
780
+ [RustCallStatus.by_ref],
781
+ :uint16
782
+ attach_function :uniffi_nova_ta_checksum_constructor_lsma_new,
783
+ [RustCallStatus.by_ref],
784
+ :uint16
785
+ attach_function :uniffi_nova_ta_checksum_constructor_ultimatesmoother_new,
786
+ [RustCallStatus.by_ref],
787
+ :uint16
788
+ attach_function :uniffi_nova_ta_checksum_constructor_linearwma_new,
789
+ [RustCallStatus.by_ref],
790
+ :uint16
791
+ attach_function :uniffi_nova_ta_checksum_constructor_cti_new,
792
+ [RustCallStatus.by_ref],
793
+ :uint16
794
+ attach_function :uniffi_nova_ta_checksum_constructor_ker_new,
795
+ [RustCallStatus.by_ref],
796
+ :uint16
797
+ attach_function :ffi_nova_ta_uniffi_contract_version,
798
+ [RustCallStatus.by_ref],
799
+ :uint32
800
+
801
+ end
802
+
803
+ # Public interface members begin here.
804
+
805
+
806
+
807
+
808
+
809
+
810
+
811
+ class Alma
812
+
813
+ # A private helper for initializing instances of the class from a raw handle,
814
+ # bypassing any initialization logic and ensuring they are GC'd properly.
815
+ def self.uniffi_allocate(handle)
816
+ inst = allocate
817
+ inst.instance_variable_set :@handle, handle
818
+ ObjectSpace.define_finalizer(inst, uniffi_define_finalizer_by_handle(handle, inst.object_id))
819
+ return inst
820
+ end
821
+
822
+ # A private helper for registering an object finalizer.
823
+ # N.B. it's important that this does not capture a reference
824
+ # to the actual instance, only its underlying handle.
825
+ def self.uniffi_define_finalizer_by_handle(handle, object_id)
826
+ Proc.new do |_id|
827
+ NovaTa.rust_call(
828
+ :uniffi_nova_ta_fn_free_alma,
829
+ handle
830
+ )
831
+ end
832
+ end
833
+
834
+ # A private helper for lowering instances into a raw handle.
835
+ # This does an explicit typecheck, because accidentally lowering a different type of
836
+ # object in a place where this type is expected, could lead to memory unsafety.
837
+ def self.uniffi_check_lower(inst)
838
+ if not inst.is_a? self
839
+ raise TypeError.new "Expected a Alma instance, got #{inst}"
840
+ end
841
+ end
842
+
843
+ def uniffi_clone_handle()
844
+ return NovaTa.rust_call(
845
+ :uniffi_nova_ta_fn_clone_alma,
846
+ @handle
847
+ )
848
+ end
849
+
850
+ def self.uniffi_lower(inst)
851
+ return inst.uniffi_clone_handle()
852
+ end
853
+ def initialize(period, offset, sigma)
854
+ period = NovaTa::uniffi_in_range(period, "u64", 0, 2**64)
855
+
856
+ offset = offset
857
+
858
+ sigma = NovaTa::uniffi_in_range(sigma, "u32", 0, 2**32)
859
+
860
+ handle = NovaTa.rust_call_with_error(NovaError,:uniffi_nova_ta_fn_constructor_alma_new,period,offset,sigma)
861
+ @handle = handle
862
+ ObjectSpace.define_finalizer(self, self.class.uniffi_define_finalizer_by_handle(handle, self.object_id))
863
+ end
864
+
865
+
866
+
867
+ def ready()
868
+ result = NovaTa.rust_call(:uniffi_nova_ta_fn_method_alma_ready,uniffi_clone_handle(),)
869
+ return 1 == result
870
+ end
871
+ def reset()
872
+ NovaTa.rust_call(:uniffi_nova_ta_fn_method_alma_reset,uniffi_clone_handle(),)
873
+ end
874
+
875
+ def update(input)
876
+ input = input
877
+
878
+ result = NovaTa.rust_call_with_error(NovaError,:uniffi_nova_ta_fn_method_alma_update,uniffi_clone_handle(),input)
879
+ return result.to_f
880
+ end
881
+
882
+ end
883
+
884
+ class Gaussian
885
+
886
+ # A private helper for initializing instances of the class from a raw handle,
887
+ # bypassing any initialization logic and ensuring they are GC'd properly.
888
+ def self.uniffi_allocate(handle)
889
+ inst = allocate
890
+ inst.instance_variable_set :@handle, handle
891
+ ObjectSpace.define_finalizer(inst, uniffi_define_finalizer_by_handle(handle, inst.object_id))
892
+ return inst
893
+ end
894
+
895
+ # A private helper for registering an object finalizer.
896
+ # N.B. it's important that this does not capture a reference
897
+ # to the actual instance, only its underlying handle.
898
+ def self.uniffi_define_finalizer_by_handle(handle, object_id)
899
+ Proc.new do |_id|
900
+ NovaTa.rust_call(
901
+ :uniffi_nova_ta_fn_free_gaussian,
902
+ handle
903
+ )
904
+ end
905
+ end
906
+
907
+ # A private helper for lowering instances into a raw handle.
908
+ # This does an explicit typecheck, because accidentally lowering a different type of
909
+ # object in a place where this type is expected, could lead to memory unsafety.
910
+ def self.uniffi_check_lower(inst)
911
+ if not inst.is_a? self
912
+ raise TypeError.new "Expected a Gaussian instance, got #{inst}"
913
+ end
914
+ end
915
+
916
+ def uniffi_clone_handle()
917
+ return NovaTa.rust_call(
918
+ :uniffi_nova_ta_fn_clone_gaussian,
919
+ @handle
920
+ )
921
+ end
922
+
923
+ def self.uniffi_lower(inst)
924
+ return inst.uniffi_clone_handle()
925
+ end
926
+ def initialize(period, sigma)
927
+ period = NovaTa::uniffi_in_range(period, "u64", 0, 2**64)
928
+
929
+ sigma = sigma
930
+
931
+ handle = NovaTa.rust_call_with_error(NovaError,:uniffi_nova_ta_fn_constructor_gaussian_new,period,sigma)
932
+ @handle = handle
933
+ ObjectSpace.define_finalizer(self, self.class.uniffi_define_finalizer_by_handle(handle, self.object_id))
934
+ end
935
+
936
+
937
+
938
+ def ready()
939
+ result = NovaTa.rust_call(:uniffi_nova_ta_fn_method_gaussian_ready,uniffi_clone_handle(),)
940
+ return 1 == result
941
+ end
942
+ def reset()
943
+ NovaTa.rust_call(:uniffi_nova_ta_fn_method_gaussian_reset,uniffi_clone_handle(),)
944
+ end
945
+
946
+ def update(input)
947
+ input = input
948
+
949
+ result = NovaTa.rust_call_with_error(NovaError,:uniffi_nova_ta_fn_method_gaussian_update,uniffi_clone_handle(),input)
950
+ return result.to_f
951
+ end
952
+
953
+ end
954
+
955
+ class Kama
956
+
957
+ # A private helper for initializing instances of the class from a raw handle,
958
+ # bypassing any initialization logic and ensuring they are GC'd properly.
959
+ def self.uniffi_allocate(handle)
960
+ inst = allocate
961
+ inst.instance_variable_set :@handle, handle
962
+ ObjectSpace.define_finalizer(inst, uniffi_define_finalizer_by_handle(handle, inst.object_id))
963
+ return inst
964
+ end
965
+
966
+ # A private helper for registering an object finalizer.
967
+ # N.B. it's important that this does not capture a reference
968
+ # to the actual instance, only its underlying handle.
969
+ def self.uniffi_define_finalizer_by_handle(handle, object_id)
970
+ Proc.new do |_id|
971
+ NovaTa.rust_call(
972
+ :uniffi_nova_ta_fn_free_kama,
973
+ handle
974
+ )
975
+ end
976
+ end
977
+
978
+ # A private helper for lowering instances into a raw handle.
979
+ # This does an explicit typecheck, because accidentally lowering a different type of
980
+ # object in a place where this type is expected, could lead to memory unsafety.
981
+ def self.uniffi_check_lower(inst)
982
+ if not inst.is_a? self
983
+ raise TypeError.new "Expected a Kama instance, got #{inst}"
984
+ end
985
+ end
986
+
987
+ def uniffi_clone_handle()
988
+ return NovaTa.rust_call(
989
+ :uniffi_nova_ta_fn_clone_kama,
990
+ @handle
991
+ )
992
+ end
993
+
994
+ def self.uniffi_lower(inst)
995
+ return inst.uniffi_clone_handle()
996
+ end
997
+ def initialize(fast, slow, ker)
998
+ fast = NovaTa::uniffi_in_range(fast, "u64", 0, 2**64)
999
+
1000
+ slow = NovaTa::uniffi_in_range(slow, "u64", 0, 2**64)
1001
+
1002
+ ker = NovaTa::uniffi_in_range(ker, "u64", 0, 2**64)
1003
+
1004
+ handle = NovaTa.rust_call_with_error(NovaError,:uniffi_nova_ta_fn_constructor_kama_new,fast,slow,ker)
1005
+ @handle = handle
1006
+ ObjectSpace.define_finalizer(self, self.class.uniffi_define_finalizer_by_handle(handle, self.object_id))
1007
+ end
1008
+
1009
+
1010
+
1011
+ def ready()
1012
+ result = NovaTa.rust_call(:uniffi_nova_ta_fn_method_kama_ready,uniffi_clone_handle(),)
1013
+ return 1 == result
1014
+ end
1015
+ def reset()
1016
+ NovaTa.rust_call(:uniffi_nova_ta_fn_method_kama_reset,uniffi_clone_handle(),)
1017
+ end
1018
+
1019
+ def update(input)
1020
+ input = input
1021
+
1022
+ result = NovaTa.rust_call_with_error(NovaError,:uniffi_nova_ta_fn_method_kama_update,uniffi_clone_handle(),input)
1023
+ return result.to_f
1024
+ end
1025
+
1026
+ end
1027
+
1028
+ class Lsma
1029
+
1030
+ # A private helper for initializing instances of the class from a raw handle,
1031
+ # bypassing any initialization logic and ensuring they are GC'd properly.
1032
+ def self.uniffi_allocate(handle)
1033
+ inst = allocate
1034
+ inst.instance_variable_set :@handle, handle
1035
+ ObjectSpace.define_finalizer(inst, uniffi_define_finalizer_by_handle(handle, inst.object_id))
1036
+ return inst
1037
+ end
1038
+
1039
+ # A private helper for registering an object finalizer.
1040
+ # N.B. it's important that this does not capture a reference
1041
+ # to the actual instance, only its underlying handle.
1042
+ def self.uniffi_define_finalizer_by_handle(handle, object_id)
1043
+ Proc.new do |_id|
1044
+ NovaTa.rust_call(
1045
+ :uniffi_nova_ta_fn_free_lsma,
1046
+ handle
1047
+ )
1048
+ end
1049
+ end
1050
+
1051
+ # A private helper for lowering instances into a raw handle.
1052
+ # This does an explicit typecheck, because accidentally lowering a different type of
1053
+ # object in a place where this type is expected, could lead to memory unsafety.
1054
+ def self.uniffi_check_lower(inst)
1055
+ if not inst.is_a? self
1056
+ raise TypeError.new "Expected a Lsma instance, got #{inst}"
1057
+ end
1058
+ end
1059
+
1060
+ def uniffi_clone_handle()
1061
+ return NovaTa.rust_call(
1062
+ :uniffi_nova_ta_fn_clone_lsma,
1063
+ @handle
1064
+ )
1065
+ end
1066
+
1067
+ def self.uniffi_lower(inst)
1068
+ return inst.uniffi_clone_handle()
1069
+ end
1070
+ def initialize(period)
1071
+ period = NovaTa::uniffi_in_range(period, "u64", 0, 2**64)
1072
+
1073
+ handle = NovaTa.rust_call_with_error(NovaError,:uniffi_nova_ta_fn_constructor_lsma_new,period)
1074
+ @handle = handle
1075
+ ObjectSpace.define_finalizer(self, self.class.uniffi_define_finalizer_by_handle(handle, self.object_id))
1076
+ end
1077
+
1078
+
1079
+
1080
+ def ready()
1081
+ result = NovaTa.rust_call(:uniffi_nova_ta_fn_method_lsma_ready,uniffi_clone_handle(),)
1082
+ return 1 == result
1083
+ end
1084
+ def reset()
1085
+ NovaTa.rust_call(:uniffi_nova_ta_fn_method_lsma_reset,uniffi_clone_handle(),)
1086
+ end
1087
+
1088
+ def update(input)
1089
+ input = input
1090
+
1091
+ result = NovaTa.rust_call_with_error(NovaError,:uniffi_nova_ta_fn_method_lsma_update,uniffi_clone_handle(),input)
1092
+ return result.to_f
1093
+ end
1094
+
1095
+ end
1096
+
1097
+ class UltimateSmoother
1098
+
1099
+ # A private helper for initializing instances of the class from a raw handle,
1100
+ # bypassing any initialization logic and ensuring they are GC'd properly.
1101
+ def self.uniffi_allocate(handle)
1102
+ inst = allocate
1103
+ inst.instance_variable_set :@handle, handle
1104
+ ObjectSpace.define_finalizer(inst, uniffi_define_finalizer_by_handle(handle, inst.object_id))
1105
+ return inst
1106
+ end
1107
+
1108
+ # A private helper for registering an object finalizer.
1109
+ # N.B. it's important that this does not capture a reference
1110
+ # to the actual instance, only its underlying handle.
1111
+ def self.uniffi_define_finalizer_by_handle(handle, object_id)
1112
+ Proc.new do |_id|
1113
+ NovaTa.rust_call(
1114
+ :uniffi_nova_ta_fn_free_ultimatesmoother,
1115
+ handle
1116
+ )
1117
+ end
1118
+ end
1119
+
1120
+ # A private helper for lowering instances into a raw handle.
1121
+ # This does an explicit typecheck, because accidentally lowering a different type of
1122
+ # object in a place where this type is expected, could lead to memory unsafety.
1123
+ def self.uniffi_check_lower(inst)
1124
+ if not inst.is_a? self
1125
+ raise TypeError.new "Expected a UltimateSmoother instance, got #{inst}"
1126
+ end
1127
+ end
1128
+
1129
+ def uniffi_clone_handle()
1130
+ return NovaTa.rust_call(
1131
+ :uniffi_nova_ta_fn_clone_ultimatesmoother,
1132
+ @handle
1133
+ )
1134
+ end
1135
+
1136
+ def self.uniffi_lower(inst)
1137
+ return inst.uniffi_clone_handle()
1138
+ end
1139
+ def initialize(period)
1140
+ period = NovaTa::uniffi_in_range(period, "u64", 0, 2**64)
1141
+
1142
+ handle = NovaTa.rust_call_with_error(NovaError,:uniffi_nova_ta_fn_constructor_ultimatesmoother_new,period)
1143
+ @handle = handle
1144
+ ObjectSpace.define_finalizer(self, self.class.uniffi_define_finalizer_by_handle(handle, self.object_id))
1145
+ end
1146
+
1147
+
1148
+
1149
+ def ready()
1150
+ result = NovaTa.rust_call(:uniffi_nova_ta_fn_method_ultimatesmoother_ready,uniffi_clone_handle(),)
1151
+ return 1 == result
1152
+ end
1153
+ def reset()
1154
+ NovaTa.rust_call(:uniffi_nova_ta_fn_method_ultimatesmoother_reset,uniffi_clone_handle(),)
1155
+ end
1156
+
1157
+ def update(input)
1158
+ input = input
1159
+
1160
+ result = NovaTa.rust_call_with_error(NovaError,:uniffi_nova_ta_fn_method_ultimatesmoother_update,uniffi_clone_handle(),input)
1161
+ return result.to_f
1162
+ end
1163
+
1164
+ end
1165
+
1166
+ class LinearWma
1167
+
1168
+ # A private helper for initializing instances of the class from a raw handle,
1169
+ # bypassing any initialization logic and ensuring they are GC'd properly.
1170
+ def self.uniffi_allocate(handle)
1171
+ inst = allocate
1172
+ inst.instance_variable_set :@handle, handle
1173
+ ObjectSpace.define_finalizer(inst, uniffi_define_finalizer_by_handle(handle, inst.object_id))
1174
+ return inst
1175
+ end
1176
+
1177
+ # A private helper for registering an object finalizer.
1178
+ # N.B. it's important that this does not capture a reference
1179
+ # to the actual instance, only its underlying handle.
1180
+ def self.uniffi_define_finalizer_by_handle(handle, object_id)
1181
+ Proc.new do |_id|
1182
+ NovaTa.rust_call(
1183
+ :uniffi_nova_ta_fn_free_linearwma,
1184
+ handle
1185
+ )
1186
+ end
1187
+ end
1188
+
1189
+ # A private helper for lowering instances into a raw handle.
1190
+ # This does an explicit typecheck, because accidentally lowering a different type of
1191
+ # object in a place where this type is expected, could lead to memory unsafety.
1192
+ def self.uniffi_check_lower(inst)
1193
+ if not inst.is_a? self
1194
+ raise TypeError.new "Expected a LinearWma instance, got #{inst}"
1195
+ end
1196
+ end
1197
+
1198
+ def uniffi_clone_handle()
1199
+ return NovaTa.rust_call(
1200
+ :uniffi_nova_ta_fn_clone_linearwma,
1201
+ @handle
1202
+ )
1203
+ end
1204
+
1205
+ def self.uniffi_lower(inst)
1206
+ return inst.uniffi_clone_handle()
1207
+ end
1208
+ def initialize(period)
1209
+ period = NovaTa::uniffi_in_range(period, "u64", 0, 2**64)
1210
+
1211
+ handle = NovaTa.rust_call_with_error(NovaError,:uniffi_nova_ta_fn_constructor_linearwma_new,period)
1212
+ @handle = handle
1213
+ ObjectSpace.define_finalizer(self, self.class.uniffi_define_finalizer_by_handle(handle, self.object_id))
1214
+ end
1215
+
1216
+
1217
+
1218
+ def ready()
1219
+ result = NovaTa.rust_call(:uniffi_nova_ta_fn_method_linearwma_ready,uniffi_clone_handle(),)
1220
+ return 1 == result
1221
+ end
1222
+ def reset()
1223
+ NovaTa.rust_call(:uniffi_nova_ta_fn_method_linearwma_reset,uniffi_clone_handle(),)
1224
+ end
1225
+
1226
+ def update(input)
1227
+ input = input
1228
+
1229
+ result = NovaTa.rust_call_with_error(NovaError,:uniffi_nova_ta_fn_method_linearwma_update,uniffi_clone_handle(),input)
1230
+ return result.to_f
1231
+ end
1232
+
1233
+ end
1234
+
1235
+ class Cti
1236
+
1237
+ # A private helper for initializing instances of the class from a raw handle,
1238
+ # bypassing any initialization logic and ensuring they are GC'd properly.
1239
+ def self.uniffi_allocate(handle)
1240
+ inst = allocate
1241
+ inst.instance_variable_set :@handle, handle
1242
+ ObjectSpace.define_finalizer(inst, uniffi_define_finalizer_by_handle(handle, inst.object_id))
1243
+ return inst
1244
+ end
1245
+
1246
+ # A private helper for registering an object finalizer.
1247
+ # N.B. it's important that this does not capture a reference
1248
+ # to the actual instance, only its underlying handle.
1249
+ def self.uniffi_define_finalizer_by_handle(handle, object_id)
1250
+ Proc.new do |_id|
1251
+ NovaTa.rust_call(
1252
+ :uniffi_nova_ta_fn_free_cti,
1253
+ handle
1254
+ )
1255
+ end
1256
+ end
1257
+
1258
+ # A private helper for lowering instances into a raw handle.
1259
+ # This does an explicit typecheck, because accidentally lowering a different type of
1260
+ # object in a place where this type is expected, could lead to memory unsafety.
1261
+ def self.uniffi_check_lower(inst)
1262
+ if not inst.is_a? self
1263
+ raise TypeError.new "Expected a Cti instance, got #{inst}"
1264
+ end
1265
+ end
1266
+
1267
+ def uniffi_clone_handle()
1268
+ return NovaTa.rust_call(
1269
+ :uniffi_nova_ta_fn_clone_cti,
1270
+ @handle
1271
+ )
1272
+ end
1273
+
1274
+ def self.uniffi_lower(inst)
1275
+ return inst.uniffi_clone_handle()
1276
+ end
1277
+ def initialize(period)
1278
+ period = NovaTa::uniffi_in_range(period, "u64", 0, 2**64)
1279
+
1280
+ handle = NovaTa.rust_call_with_error(NovaError,:uniffi_nova_ta_fn_constructor_cti_new,period)
1281
+ @handle = handle
1282
+ ObjectSpace.define_finalizer(self, self.class.uniffi_define_finalizer_by_handle(handle, self.object_id))
1283
+ end
1284
+
1285
+
1286
+
1287
+ def ready()
1288
+ result = NovaTa.rust_call(:uniffi_nova_ta_fn_method_cti_ready,uniffi_clone_handle(),)
1289
+ return 1 == result
1290
+ end
1291
+ def reset()
1292
+ NovaTa.rust_call(:uniffi_nova_ta_fn_method_cti_reset,uniffi_clone_handle(),)
1293
+ end
1294
+
1295
+ def update(input)
1296
+ input = input
1297
+
1298
+ result = NovaTa.rust_call_with_error(NovaError,:uniffi_nova_ta_fn_method_cti_update,uniffi_clone_handle(),input)
1299
+ return result.to_f
1300
+ end
1301
+
1302
+ end
1303
+
1304
+ class Ker
1305
+
1306
+ # A private helper for initializing instances of the class from a raw handle,
1307
+ # bypassing any initialization logic and ensuring they are GC'd properly.
1308
+ def self.uniffi_allocate(handle)
1309
+ inst = allocate
1310
+ inst.instance_variable_set :@handle, handle
1311
+ ObjectSpace.define_finalizer(inst, uniffi_define_finalizer_by_handle(handle, inst.object_id))
1312
+ return inst
1313
+ end
1314
+
1315
+ # A private helper for registering an object finalizer.
1316
+ # N.B. it's important that this does not capture a reference
1317
+ # to the actual instance, only its underlying handle.
1318
+ def self.uniffi_define_finalizer_by_handle(handle, object_id)
1319
+ Proc.new do |_id|
1320
+ NovaTa.rust_call(
1321
+ :uniffi_nova_ta_fn_free_ker,
1322
+ handle
1323
+ )
1324
+ end
1325
+ end
1326
+
1327
+ # A private helper for lowering instances into a raw handle.
1328
+ # This does an explicit typecheck, because accidentally lowering a different type of
1329
+ # object in a place where this type is expected, could lead to memory unsafety.
1330
+ def self.uniffi_check_lower(inst)
1331
+ if not inst.is_a? self
1332
+ raise TypeError.new "Expected a Ker instance, got #{inst}"
1333
+ end
1334
+ end
1335
+
1336
+ def uniffi_clone_handle()
1337
+ return NovaTa.rust_call(
1338
+ :uniffi_nova_ta_fn_clone_ker,
1339
+ @handle
1340
+ )
1341
+ end
1342
+
1343
+ def self.uniffi_lower(inst)
1344
+ return inst.uniffi_clone_handle()
1345
+ end
1346
+ def initialize(period)
1347
+ period = NovaTa::uniffi_in_range(period, "u64", 0, 2**64)
1348
+
1349
+ handle = NovaTa.rust_call_with_error(NovaError,:uniffi_nova_ta_fn_constructor_ker_new,period)
1350
+ @handle = handle
1351
+ ObjectSpace.define_finalizer(self, self.class.uniffi_define_finalizer_by_handle(handle, self.object_id))
1352
+ end
1353
+
1354
+
1355
+
1356
+ def ready()
1357
+ result = NovaTa.rust_call(:uniffi_nova_ta_fn_method_ker_ready,uniffi_clone_handle(),)
1358
+ return 1 == result
1359
+ end
1360
+ def reset()
1361
+ NovaTa.rust_call(:uniffi_nova_ta_fn_method_ker_reset,uniffi_clone_handle(),)
1362
+ end
1363
+
1364
+ def update(input)
1365
+ input = input
1366
+
1367
+ result = NovaTa.rust_call_with_error(NovaError,:uniffi_nova_ta_fn_method_ker_update,uniffi_clone_handle(),input)
1368
+ return result.to_f
1369
+ end
1370
+
1371
+ end
1372
+
1373
+ end
1374
+
metadata ADDED
@@ -0,0 +1,54 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: nova_ta
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.2
5
+ platform: x64-mingw-ucrt
6
+ authors:
7
+ - Rick-29
8
+ bindir: bin
9
+ cert_chain: []
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
+ dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: ffi
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - "~>"
17
+ - !ruby/object:Gem::Version
18
+ version: '1.16'
19
+ type: :runtime
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - "~>"
24
+ - !ruby/object:Gem::Version
25
+ version: '1.16'
26
+ description: Ruby bindings (via UniFFI) for the nova-ta Rust crate.
27
+ executables: []
28
+ extensions: []
29
+ extra_rdoc_files: []
30
+ files:
31
+ - lib/nova_ta.dll
32
+ - lib/nova_ta.rb
33
+ homepage: https://github.com/Rick-29/nova
34
+ licenses:
35
+ - MIT
36
+ metadata: {}
37
+ rdoc_options: []
38
+ require_paths:
39
+ - lib
40
+ required_ruby_version: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ version: '3.0'
45
+ required_rubygems_version: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: '0'
50
+ requirements: []
51
+ rubygems_version: 4.0.20
52
+ specification_version: 4
53
+ summary: Stateful technical-analysis indicators for real-time data.
54
+ test_files: []