chordsketch 0.5.0 → 0.6.0

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.
@@ -14,7 +14,7 @@
14
14
  # helpers directly inline like we're doing here.
15
15
 
16
16
  require 'ffi'
17
-
17
+ require 'set'
18
18
 
19
19
  module Chordsketch
20
20
  def self.uniffi_in_range(i, type_name, min, max)
@@ -36,21 +36,64 @@ def self.uniffi_bytes(v)
36
36
  v.to_str
37
37
  end
38
38
 
39
+ # Callback return codes
40
+ UNIFFI_CALLBACK_SUCCESS = 0
41
+ UNIFFI_CALLBACK_ERROR = 1
42
+ UNIFFI_CALLBACK_UNEXPECTED_ERROR = 2
43
+
44
+ # Call a method on a callback interface object, catching and reporting errors
45
+ # to Rust via the call_status.
46
+ # If error_type is provided, known errors of that type are reported as UNIFFI_CALLBACK_ERROR;
47
+ # all other errors are reported as UNIFFI_CALLBACK_UNEXPECTED_ERROR.
48
+ def self.uniffi_trait_interface_call(call_status, make_call, write_return_value, error_type = nil, lower_error = nil)
49
+ begin
50
+ write_return_value.call make_call.call
51
+ rescue StandardError => e
52
+ buf = if !error_type.nil? && uniffi_is_error_type?(e, error_type)
53
+ call_status[:code] = UNIFFI_CALLBACK_ERROR
54
+ lower_error.call e
55
+ else
56
+ call_status[:code] = UNIFFI_CALLBACK_UNEXPECTED_ERROR
57
+ RustBuffer.alloc_from_string(e.inspect)
58
+ end
59
+
60
+ error_buf = call_status[:error_buf]
61
+ error_buf[:capacity] = buf[:capacity]
62
+ error_buf[:len] = buf[:len]
63
+ error_buf[:data] = buf[:data]
64
+ end
65
+ end
66
+
67
+ # Check if an exception is a variant of the given error type.
68
+ # Error types in Ruby are either modules (non-flat enums) or classes (flat enums),
69
+ # with variant classes as constant within them.
70
+ def self.uniffi_is_error_type?(e, error_type)
71
+ # Object-as-error: error_type is a class itself (e.g. MyError < StandardError)
72
+ if error_type.is_a?(Class) && e.is_a?(error_type)
73
+ return true
74
+ end
75
+
76
+ # Enum error: error_type is a module with class constants for each variant
77
+ error_type.constants.any? do |c|
78
+ klass = error_type.const_get c
79
+ klass.is_a?(Class) && e.is_a?(klass)
80
+ end
81
+ end
39
82
  class RustBuffer < FFI::Struct
40
83
  layout :capacity, :uint64,
41
84
  :len, :uint64,
42
85
  :data, :pointer
43
86
 
44
87
  def self.alloc(size)
45
- return Chordsketch.rust_call(:ffi_chordsketch_ffi_rustbuffer_alloc, size)
88
+ return ::Chordsketch.rust_call(:ffi_chordsketch_ffi_rustbuffer_alloc, size)
46
89
  end
47
90
 
48
91
  def self.reserve(rbuf, additional)
49
- return Chordsketch.rust_call(:ffi_chordsketch_ffi_rustbuffer_reserve, rbuf, additional)
92
+ return ::Chordsketch.rust_call(:ffi_chordsketch_ffi_rustbuffer_reserve, rbuf, additional)
50
93
  end
51
94
 
52
95
  def free
53
- Chordsketch.rust_call(:ffi_chordsketch_ffi_rustbuffer_free, self)
96
+ ::Chordsketch.rust_call(:ffi_chordsketch_ffi_rustbuffer_free, self)
54
97
  end
55
98
 
56
99
  def capacity
@@ -98,14 +141,14 @@ end
98
141
  free
99
142
  end# The primitive String type.
100
143
 
101
- def self.allocFromString(value)
144
+ def self.alloc_from_string(value)
102
145
  RustBuffer.allocWithBuilder do |builder|
103
146
  builder.write value.encode('utf-8')
104
147
  return builder.finalize
105
148
  end
106
149
  end
107
150
 
108
- def consumeIntoString
151
+ def consume_into_string
109
152
  consumeWithStream do |stream|
110
153
  return stream.read(stream.remaining).force_encoding(Encoding::UTF_8)
111
154
  end
@@ -113,16 +156,16 @@ end
113
156
 
114
157
  # The primitive Bytes type.
115
158
 
116
- def self.allocFromBytes(value)
159
+ def self.alloc_from_bytes(value)
117
160
  RustBuffer.allocWithBuilder do |builder|
118
- builder.write_Bytes(value)
161
+ builder.write_bytes(value)
119
162
  return builder.finalize
120
163
  end
121
164
  end
122
165
 
123
- def consumeIntoBytes
166
+ def consume_into_bytes
124
167
  consumeWithStream do |stream|
125
- return stream.readBytes
168
+ return stream.read_bytes
126
169
  end
127
170
  end
128
171
 
@@ -140,9 +183,9 @@ end
140
183
  end
141
184
  end
142
185
 
143
- def consumeIntoTypeChordDefine
186
+ def consume_into_TypeChordDefine
144
187
  consumeWithStream do |stream|
145
- return stream.readTypeChordDefine
188
+ return stream.read_TypeChordDefine
146
189
  end
147
190
  end
148
191
 
@@ -160,9 +203,9 @@ end
160
203
  end
161
204
  end
162
205
 
163
- def consumeIntoTypeConversionWithWarnings
206
+ def consume_into_TypeConversionWithWarnings
164
207
  consumeWithStream do |stream|
165
- return stream.readTypeConversionWithWarnings
208
+ return stream.read_TypeConversionWithWarnings
166
209
  end
167
210
  end
168
211
 
@@ -180,9 +223,31 @@ end
180
223
  end
181
224
  end
182
225
 
183
- def consumeIntoTypePdfRenderWithWarnings
226
+ def consume_into_TypePdfRenderWithWarnings
227
+ consumeWithStream do |stream|
228
+ return stream.read_TypePdfRenderWithWarnings
229
+ end
230
+ end
231
+
232
+ # The Record type StaffNote.
233
+
234
+ def self.check_lower_TypeStaffNote(v)
235
+
236
+
237
+
238
+
239
+ end
240
+
241
+ def self.alloc_from_TypeStaffNote(v)
242
+ RustBuffer.allocWithBuilder do |builder|
243
+ builder.write_TypeStaffNote(v)
244
+ return builder.finalize
245
+ end
246
+ end
247
+
248
+ def consume_into_TypeStaffNote
184
249
  consumeWithStream do |stream|
185
- return stream.readTypePdfRenderWithWarnings
250
+ return stream.read_TypeStaffNote
186
251
  end
187
252
  end
188
253
 
@@ -200,9 +265,9 @@ end
200
265
  end
201
266
  end
202
267
 
203
- def consumeIntoTypeTextRenderWithWarnings
268
+ def consume_into_TypeTextRenderWithWarnings
204
269
  consumeWithStream do |stream|
205
- return stream.readTypeTextRenderWithWarnings
270
+ return stream.read_TypeTextRenderWithWarnings
206
271
  end
207
272
  end
208
273
 
@@ -221,18 +286,32 @@ end
221
286
  end
222
287
  end
223
288
 
224
- def consumeIntoTypeValidationError
289
+ def consume_into_TypeValidationError
225
290
  consumeWithStream do |stream|
226
- return stream.readTypeValidationError
291
+ return stream.read_TypeValidationError
292
+ end
293
+ end
294
+
295
+ # Error enum - generate alloc_from for callback error serialization
296
+ def self.alloc_from_TypeChordSketchError(v)
297
+ RustBuffer.allocWithBuilder do |builder|
298
+ builder.write_TypeChordSketchError(v)
299
+ return builder.finalize
227
300
  end
228
301
  end
229
302
 
303
+ # Enum used as error - generate consume_into_ for use as a return value
304
+ def consume_into_TypeChordSketchError
305
+ consumeWithStream do |stream|
306
+ return stream.read_TypeChordSketchError
307
+ end
308
+ end
230
309
 
231
310
 
232
311
  # The Optional<T> type for i8.
233
312
 
234
313
  def self.check_lower_Optionali8(v)
235
- if not v.nil?
314
+ if !v.nil?
236
315
 
237
316
  end
238
317
  end
@@ -244,16 +323,16 @@ end
244
323
  end
245
324
  end
246
325
 
247
- def consumeIntoOptionali8
326
+ def consume_into_Optionali8
248
327
  consumeWithStream do |stream|
249
- return stream.readOptionali8
328
+ return stream.read_Optionali8
250
329
  end
251
330
  end
252
331
 
253
332
  # The Optional<T> type for string.
254
333
 
255
334
  def self.check_lower_Optionalstring(v)
256
- if not v.nil?
335
+ if !v.nil?
257
336
 
258
337
  end
259
338
  end
@@ -265,9 +344,72 @@ end
265
344
  end
266
345
  end
267
346
 
268
- def consumeIntoOptionalstring
347
+ def consume_into_Optionalstring
348
+ consumeWithStream do |stream|
349
+ return stream.read_Optionalstring
350
+ end
351
+ end
352
+
353
+ # The Optional<T> type for Sequenceu8.
354
+
355
+ def self.check_lower_OptionalSequenceu8(v)
356
+ if !v.nil?
357
+ RustBuffer.check_lower_Sequenceu8(v)
358
+ end
359
+ end
360
+
361
+ def self.alloc_from_OptionalSequenceu8(v)
362
+ RustBuffer.allocWithBuilder do |builder|
363
+ builder.write_OptionalSequenceu8(v)
364
+ return builder.finalize()
365
+ end
366
+ end
367
+
368
+ def consume_into_OptionalSequenceu8
369
+ consumeWithStream do |stream|
370
+ return stream.read_OptionalSequenceu8
371
+ end
372
+ end
373
+
374
+ # The Optional<T> type for SequenceTypeStaffNote.
375
+
376
+ def self.check_lower_OptionalSequenceTypeStaffNote(v)
377
+ if !v.nil?
378
+ RustBuffer.check_lower_SequenceTypeStaffNote(v)
379
+ end
380
+ end
381
+
382
+ def self.alloc_from_OptionalSequenceTypeStaffNote(v)
383
+ RustBuffer.allocWithBuilder do |builder|
384
+ builder.write_OptionalSequenceTypeStaffNote(v)
385
+ return builder.finalize()
386
+ end
387
+ end
388
+
389
+ def consume_into_OptionalSequenceTypeStaffNote
390
+ consumeWithStream do |stream|
391
+ return stream.read_OptionalSequenceTypeStaffNote
392
+ end
393
+ end
394
+
395
+ # The Sequence<T> type for u8.
396
+
397
+ def self.check_lower_Sequenceu8(v)
398
+ v.each do |item|
399
+
400
+ end
401
+ end
402
+
403
+ def self.alloc_from_Sequenceu8(v)
404
+ RustBuffer.allocWithBuilder do |builder|
405
+ builder.write_Sequenceu8(v)
406
+ return builder.finalize()
407
+ end
408
+ end
409
+
410
+ def consume_into_Sequenceu8
269
411
  consumeWithStream do |stream|
270
- return stream.readOptionalstring
412
+ return stream.read_Sequenceu8
271
413
  end
272
414
  end
273
415
 
@@ -286,9 +428,9 @@ end
286
428
  end
287
429
  end
288
430
 
289
- def consumeIntoSequencestring
431
+ def consume_into_Sequencestring
290
432
  consumeWithStream do |stream|
291
- return stream.readSequencestring
433
+ return stream.read_Sequencestring
292
434
  end
293
435
  end
294
436
 
@@ -307,9 +449,30 @@ end
307
449
  end
308
450
  end
309
451
 
310
- def consumeIntoSequenceTypeChordDefine
452
+ def consume_into_SequenceTypeChordDefine
453
+ consumeWithStream do |stream|
454
+ return stream.read_SequenceTypeChordDefine
455
+ end
456
+ end
457
+
458
+ # The Sequence<T> type for TypeStaffNote.
459
+
460
+ def self.check_lower_SequenceTypeStaffNote(v)
461
+ v.each do |item|
462
+ RustBuffer.check_lower_TypeStaffNote(item)
463
+ end
464
+ end
465
+
466
+ def self.alloc_from_SequenceTypeStaffNote(v)
467
+ RustBuffer.allocWithBuilder do |builder|
468
+ builder.write_SequenceTypeStaffNote(v)
469
+ return builder.finalize()
470
+ end
471
+ end
472
+
473
+ def consume_into_SequenceTypeStaffNote
311
474
  consumeWithStream do |stream|
312
- return stream.readSequenceTypeChordDefine
475
+ return stream.read_SequenceTypeStaffNote
313
476
  end
314
477
  end
315
478
 
@@ -328,9 +491,9 @@ end
328
491
  end
329
492
  end
330
493
 
331
- def consumeIntoSequenceTypeValidationError
494
+ def consume_into_SequenceTypeValidationError
332
495
  consumeWithStream do |stream|
333
- return stream.readSequenceTypeValidationError
496
+ return stream.read_SequenceTypeValidationError
334
497
  end
335
498
  end
336
499
 
@@ -380,15 +543,19 @@ class RustBufferStream
380
543
  data
381
544
  end
382
545
 
383
- def readI8
546
+ def read_u8
547
+ unpack_from 1, 'c'
548
+ end
549
+
550
+ def read_i8
384
551
  unpack_from 1, 'c'
385
552
  end
386
553
 
387
- def readU32
554
+ def read_u32
388
555
  unpack_from 4, 'L>'
389
556
  end
390
557
 
391
- def readString
558
+ def read_string
392
559
  size = unpack_from 4, 'l>'
393
560
 
394
561
  raise InternalError, 'Unexpected negative string length' if size.negative?
@@ -396,7 +563,7 @@ class RustBufferStream
396
563
  read(size).force_encoding(Encoding::UTF_8)
397
564
  end
398
565
 
399
- def readBytes
566
+ def read_bytes
400
567
  size = unpack_from 4, 'l>'
401
568
 
402
569
  raise InternalError, 'Unexpected negative byte string length' if size.negative?
@@ -406,47 +573,58 @@ class RustBufferStream
406
573
 
407
574
  # The Record type ChordDefine.
408
575
 
409
- def readTypeChordDefine
576
+ def read_TypeChordDefine
410
577
  ChordDefine.new(
411
- name: readString,
412
- raw: readString
578
+ name: read_string,
579
+ raw: read_string
413
580
  )
414
581
  end
415
582
 
416
583
  # The Record type ConversionWithWarnings.
417
584
 
418
- def readTypeConversionWithWarnings
585
+ def read_TypeConversionWithWarnings
419
586
  ConversionWithWarnings.new(
420
- output: readString,
421
- warnings: readSequencestring
587
+ output: read_string,
588
+ warnings: read_Sequencestring
422
589
  )
423
590
  end
424
591
 
425
592
  # The Record type PdfRenderWithWarnings.
426
593
 
427
- def readTypePdfRenderWithWarnings
594
+ def read_TypePdfRenderWithWarnings
428
595
  PdfRenderWithWarnings.new(
429
- output: readBytes,
430
- warnings: readSequencestring
596
+ output: read_bytes,
597
+ warnings: read_Sequencestring
598
+ )
599
+ end
600
+
601
+ # The Record type StaffNote.
602
+
603
+ def read_TypeStaffNote
604
+ StaffNote.new(
605
+ letter: read_string,
606
+ accidental: read_i8,
607
+ octave: read_i8,
608
+ midi: read_u8
431
609
  )
432
610
  end
433
611
 
434
612
  # The Record type TextRenderWithWarnings.
435
613
 
436
- def readTypeTextRenderWithWarnings
614
+ def read_TypeTextRenderWithWarnings
437
615
  TextRenderWithWarnings.new(
438
- output: readString,
439
- warnings: readSequencestring
616
+ output: read_string,
617
+ warnings: read_Sequencestring
440
618
  )
441
619
  end
442
620
 
443
621
  # The Record type ValidationError.
444
622
 
445
- def readTypeValidationError
623
+ def read_TypeValidationError
446
624
  ValidationError.new(
447
- line: readU32,
448
- column: readU32,
449
- message: readString
625
+ line: read_u32,
626
+ column: read_u32,
627
+ message: read_string
450
628
  )
451
629
  end
452
630
 
@@ -456,7 +634,7 @@ class RustBufferStream
456
634
 
457
635
  # The Error type ChordSketchError
458
636
 
459
- def readTypeChordSketchError
637
+ def read_TypeChordSketchError
460
638
  variant = unpack_from 4, 'l>'
461
639
 
462
640
  if variant == 1
@@ -464,12 +642,12 @@ class RustBufferStream
464
642
  end
465
643
  if variant == 2
466
644
  return ChordSketchError::InvalidConfig.new(
467
- readString()
645
+ reason: read_string()
468
646
  )
469
647
  end
470
648
  if variant == 3
471
649
  return ChordSketchError::ConversionFailed.new(
472
- readString()
650
+ reason: read_string()
473
651
  )
474
652
  end
475
653
 
@@ -477,37 +655,85 @@ class RustBufferStream
477
655
  end
478
656
 
479
657
 
658
+
480
659
  # The Optional<T> type for i8.
481
660
 
482
- def readOptionali8
661
+ def read_Optionali8
483
662
  flag = unpack_from 1, 'c'
484
663
 
485
664
  if flag == 0
486
665
  return nil
487
666
  elsif flag == 1
488
- return readI8
667
+ return read_i8
489
668
  else
490
669
  raise InternalError, 'Unexpected flag byte for Optionali8'
491
670
  end
492
671
  end
493
672
 
673
+
494
674
  # The Optional<T> type for string.
495
675
 
496
- def readOptionalstring
676
+ def read_Optionalstring
497
677
  flag = unpack_from 1, 'c'
498
678
 
499
679
  if flag == 0
500
680
  return nil
501
681
  elsif flag == 1
502
- return readString
682
+ return read_string
503
683
  else
504
684
  raise InternalError, 'Unexpected flag byte for Optionalstring'
505
685
  end
506
686
  end
507
687
 
688
+
689
+ # The Optional<T> type for Sequenceu8.
690
+
691
+ def read_OptionalSequenceu8
692
+ flag = unpack_from 1, 'c'
693
+
694
+ if flag == 0
695
+ return nil
696
+ elsif flag == 1
697
+ return read_Sequenceu8
698
+ else
699
+ raise InternalError, 'Unexpected flag byte for OptionalSequenceu8'
700
+ end
701
+ end
702
+
703
+
704
+ # The Optional<T> type for SequenceTypeStaffNote.
705
+
706
+ def read_OptionalSequenceTypeStaffNote
707
+ flag = unpack_from 1, 'c'
708
+
709
+ if flag == 0
710
+ return nil
711
+ elsif flag == 1
712
+ return read_SequenceTypeStaffNote
713
+ else
714
+ raise InternalError, 'Unexpected flag byte for OptionalSequenceTypeStaffNote'
715
+ end
716
+ end
717
+
718
+ # The Sequence<T> type for u8.
719
+
720
+ def read_Sequenceu8
721
+ count = unpack_from 4, 'l>'
722
+
723
+ raise InternalError, 'Unexpected negative sequence length' if count.negative?
724
+
725
+ items = []
726
+
727
+ count.times do
728
+ items.append read_u8
729
+ end
730
+
731
+ items
732
+ end
733
+
508
734
  # The Sequence<T> type for string.
509
735
 
510
- def readSequencestring
736
+ def read_Sequencestring
511
737
  count = unpack_from 4, 'l>'
512
738
 
513
739
  raise InternalError, 'Unexpected negative sequence length' if count.negative?
@@ -515,7 +741,7 @@ class RustBufferStream
515
741
  items = []
516
742
 
517
743
  count.times do
518
- items.append readString
744
+ items.append read_string
519
745
  end
520
746
 
521
747
  items
@@ -523,7 +749,23 @@ class RustBufferStream
523
749
 
524
750
  # The Sequence<T> type for TypeChordDefine.
525
751
 
526
- def readSequenceTypeChordDefine
752
+ def read_SequenceTypeChordDefine
753
+ count = unpack_from 4, 'l>'
754
+
755
+ raise InternalError, 'Unexpected negative sequence length' if count.negative?
756
+
757
+ items = []
758
+
759
+ count.times do
760
+ items.append read_TypeChordDefine
761
+ end
762
+
763
+ items
764
+ end
765
+
766
+ # The Sequence<T> type for TypeStaffNote.
767
+
768
+ def read_SequenceTypeStaffNote
527
769
  count = unpack_from 4, 'l>'
528
770
 
529
771
  raise InternalError, 'Unexpected negative sequence length' if count.negative?
@@ -531,7 +773,7 @@ class RustBufferStream
531
773
  items = []
532
774
 
533
775
  count.times do
534
- items.append readTypeChordDefine
776
+ items.append read_TypeStaffNote
535
777
  end
536
778
 
537
779
  items
@@ -539,7 +781,7 @@ class RustBufferStream
539
781
 
540
782
  # The Sequence<T> type for TypeValidationError.
541
783
 
542
- def readSequenceTypeValidationError
784
+ def read_SequenceTypeValidationError
543
785
  count = unpack_from 4, 'l>'
544
786
 
545
787
  raise InternalError, 'Unexpected negative sequence length' if count.negative?
@@ -547,7 +789,7 @@ class RustBufferStream
547
789
  items = []
548
790
 
549
791
  count.times do
550
- items.append readTypeValidationError
792
+ items.append read_TypeValidationError
551
793
  end
552
794
 
553
795
  items
@@ -599,24 +841,29 @@ class RustBufferBuilder
599
841
  end
600
842
  end
601
843
 
602
- def write_I8(v)
603
- v = Chordsketch::uniffi_in_range(v, "i8", -2**7, 2**7)
844
+ def write_u8(v)
845
+ v = ::Chordsketch::uniffi_in_range(v, "u8", 0, 2**8)
846
+ pack_into(1, 'c', v)
847
+ end
848
+
849
+ def write_i8(v)
850
+ v = ::Chordsketch::uniffi_in_range(v, "i8", -2**7, 2**7)
604
851
  pack_into(1, 'c', v)
605
852
  end
606
853
 
607
- def write_U32(v)
608
- v = Chordsketch::uniffi_in_range(v, "u32", 0, 2**32)
854
+ def write_u32(v)
855
+ v = ::Chordsketch::uniffi_in_range(v, "u32", 0, 2**32)
609
856
  pack_into(4, 'L>', v)
610
857
  end
611
858
 
612
- def write_String(v)
613
- v = Chordsketch::uniffi_utf8(v)
859
+ def write_string(v)
860
+ v = ::Chordsketch::uniffi_utf8(v)
614
861
  pack_into 4, 'l>', v.bytes.size
615
862
  write v
616
863
  end
617
864
 
618
- def write_Bytes(v)
619
- v = Chordsketch::uniffi_bytes(v)
865
+ def write_bytes(v)
866
+ v = ::Chordsketch::uniffi_bytes(v)
620
867
  pack_into 4, 'l>', v.bytes.size
621
868
  write v
622
869
  end
@@ -624,39 +871,66 @@ class RustBufferBuilder
624
871
  # The Record type ChordDefine.
625
872
 
626
873
  def write_TypeChordDefine(v)
627
- self.write_String(v.name)
628
- self.write_String(v.raw)
874
+ self.write_string(v.name)
875
+ self.write_string(v.raw)
629
876
  end
630
877
 
631
878
  # The Record type ConversionWithWarnings.
632
879
 
633
880
  def write_TypeConversionWithWarnings(v)
634
- self.write_String(v.output)
881
+ self.write_string(v.output)
635
882
  self.write_Sequencestring(v.warnings)
636
883
  end
637
884
 
638
885
  # The Record type PdfRenderWithWarnings.
639
886
 
640
887
  def write_TypePdfRenderWithWarnings(v)
641
- self.write_Bytes(v.output)
888
+ self.write_bytes(v.output)
642
889
  self.write_Sequencestring(v.warnings)
643
890
  end
644
891
 
892
+ # The Record type StaffNote.
893
+
894
+ def write_TypeStaffNote(v)
895
+ self.write_string(v.letter)
896
+ self.write_i8(v.accidental)
897
+ self.write_i8(v.octave)
898
+ self.write_u8(v.midi)
899
+ end
900
+
645
901
  # The Record type TextRenderWithWarnings.
646
902
 
647
903
  def write_TypeTextRenderWithWarnings(v)
648
- self.write_String(v.output)
904
+ self.write_string(v.output)
649
905
  self.write_Sequencestring(v.warnings)
650
906
  end
651
907
 
652
908
  # The Record type ValidationError.
653
909
 
654
910
  def write_TypeValidationError(v)
655
- self.write_U32(v.line)
656
- self.write_U32(v.column)
657
- self.write_String(v.message)
911
+ self.write_u32(v.line)
912
+ self.write_u32(v.column)
913
+ self.write_string(v.message)
658
914
  end
659
915
 
916
+ # The Error type ChordSketchError - write for callback error returns.
917
+
918
+ def write_TypeChordSketchError(v)
919
+ if v.is_a?(ChordSketchError::NoSongsFound)
920
+ pack_into 4, 'l>', 1
921
+ return
922
+ end
923
+ if v.is_a?(ChordSketchError::InvalidConfig)
924
+ pack_into 4, 'l>', 2
925
+ self.write_string(v.reason)
926
+ return
927
+ end
928
+ if v.is_a?(ChordSketchError::ConversionFailed)
929
+ pack_into 4, 'l>', 3
930
+ self.write_string(v.reason)
931
+ return
932
+ end
933
+ end
660
934
 
661
935
 
662
936
  # The Optional<T> type for i8.
@@ -666,7 +940,7 @@ class RustBufferBuilder
666
940
  pack_into(1, 'c', 0)
667
941
  else
668
942
  pack_into(1, 'c', 1)
669
- self.write_I8(v)
943
+ self.write_i8(v)
670
944
  end
671
945
  end
672
946
 
@@ -677,7 +951,39 @@ class RustBufferBuilder
677
951
  pack_into(1, 'c', 0)
678
952
  else
679
953
  pack_into(1, 'c', 1)
680
- self.write_String(v)
954
+ self.write_string(v)
955
+ end
956
+ end
957
+
958
+ # The Optional<T> type for Sequenceu8.
959
+
960
+ def write_OptionalSequenceu8(v)
961
+ if v.nil?
962
+ pack_into(1, 'c', 0)
963
+ else
964
+ pack_into(1, 'c', 1)
965
+ self.write_Sequenceu8(v)
966
+ end
967
+ end
968
+
969
+ # The Optional<T> type for SequenceTypeStaffNote.
970
+
971
+ def write_OptionalSequenceTypeStaffNote(v)
972
+ if v.nil?
973
+ pack_into(1, 'c', 0)
974
+ else
975
+ pack_into(1, 'c', 1)
976
+ self.write_SequenceTypeStaffNote(v)
977
+ end
978
+ end
979
+
980
+ # The Sequence<T> type for u8.
981
+
982
+ def write_Sequenceu8(items)
983
+ pack_into(4, 'l>', items.size)
984
+
985
+ items.each do |item|
986
+ self.write_u8(item)
681
987
  end
682
988
  end
683
989
 
@@ -687,7 +993,7 @@ class RustBufferBuilder
687
993
  pack_into(4, 'l>', items.size)
688
994
 
689
995
  items.each do |item|
690
- self.write_String(item)
996
+ self.write_string(item)
691
997
  end
692
998
  end
693
999
 
@@ -701,6 +1007,16 @@ class RustBufferBuilder
701
1007
  end
702
1008
  end
703
1009
 
1010
+ # The Sequence<T> type for TypeStaffNote.
1011
+
1012
+ def write_SequenceTypeStaffNote(items)
1013
+ pack_into(4, 'l>', items.size)
1014
+
1015
+ items.each do |item|
1016
+ self.write_TypeStaffNote(item)
1017
+ end
1018
+ end
1019
+
704
1020
  # The Sequence<T> type for TypeValidationError.
705
1021
 
706
1022
  def write_SequenceTypeValidationError(items)
@@ -761,37 +1077,48 @@ CALL_PANIC = 2
761
1077
  module ChordSketchError
762
1078
  class NoSongsFound < StandardError
763
1079
  def initialize()
1080
+
764
1081
  super()
765
- end
1082
+ end
1083
+
766
1084
 
767
1085
  def to_s
768
- "#{self.class.name}()"
1086
+ "#{self.class.name}()"
1087
+
769
1088
  end
770
1089
  end
771
1090
  class InvalidConfig < StandardError
772
- def initialize(reason)
1091
+ def initialize(reason:)
1092
+
773
1093
  @reason = reason
1094
+
774
1095
  super()
775
- end
1096
+ end
1097
+
776
1098
 
777
1099
  attr_reader :reason
778
1100
 
779
1101
 
780
1102
  def to_s
781
- "#{self.class.name}(reason=#{@reason.inspect})"
1103
+ "#{self.class.name}(reason=#{@reason.inspect})"
1104
+
782
1105
  end
783
1106
  end
784
1107
  class ConversionFailed < StandardError
785
- def initialize(reason)
1108
+ def initialize(reason:)
1109
+
786
1110
  @reason = reason
1111
+
787
1112
  super()
788
- end
1113
+ end
1114
+
789
1115
 
790
1116
  attr_reader :reason
791
1117
 
792
1118
 
793
1119
  def to_s
794
- "#{self.class.name}(reason=#{@reason.inspect})"
1120
+ "#{self.class.name}(reason=#{@reason.inspect})"
1121
+
795
1122
  end
796
1123
  end
797
1124
 
@@ -800,9 +1127,7 @@ end
800
1127
 
801
1128
  # Map error modules to the RustBuffer method name that reads them
802
1129
  ERROR_MODULE_TO_READER_METHOD = {
803
-
804
- ChordSketchError => :readTypeChordSketchError,
805
-
1130
+ ChordSketchError => :read_TypeChordSketchError,
806
1131
  }
807
1132
 
808
1133
  private_constant :ERROR_MODULE_TO_READER_METHOD, :CALL_SUCCESS, :CALL_ERROR, :CALL_PANIC,
@@ -810,7 +1135,8 @@ private_constant :ERROR_MODULE_TO_READER_METHOD, :CALL_SUCCESS, :CALL_ERROR, :CA
810
1135
 
811
1136
  def self.consume_buffer_into_error(error_module, rust_buffer)
812
1137
  rust_buffer.consumeWithStream do |stream|
813
- reader_method = ERROR_MODULE_TO_READER_METHOD[error_module]
1138
+ reader_method = ERROR_MODULE_TO_READER_METHOD[error_module] ||
1139
+ ERROR_MODULE_TO_READER_METHOD[error_module.name&.split('::')&.last]
814
1140
  return stream.send(reader_method)
815
1141
  end
816
1142
  end
@@ -852,7 +1178,7 @@ def self.rust_call_with_error(error_module, fn_name, *args)
852
1178
  # with the message. But if that code panics, then it just sends back
853
1179
  # an empty buffer.
854
1180
  if status.error_buf.len > 0
855
- raise InternalError, status.error_buf.consumeIntoString()
1181
+ raise InternalError, status.error_buf.consume_into_string
856
1182
  else
857
1183
  raise InternalError, "Rust panic"
858
1184
  end
@@ -872,150 +1198,602 @@ module UniFFILib
872
1198
  ffi_lib Chordsketch::NATIVE_LIB_PATH
873
1199
 
874
1200
 
875
- attach_function :uniffi_chordsketch_ffi_fn_func_chord_diagram_svg,
876
- [RustBuffer.by_value, RustBuffer.by_value, RustCallStatus.by_ref],
877
- RustBuffer.by_value
878
- attach_function :uniffi_chordsketch_ffi_fn_func_chord_diagram_svg_with_defines,
879
- [RustBuffer.by_value, RustBuffer.by_value, RustBuffer.by_value, RustCallStatus.by_ref],
880
- RustBuffer.by_value
881
- attach_function :uniffi_chordsketch_ffi_fn_func_convert_chordpro_to_irealb,
882
- [RustBuffer.by_value, RustCallStatus.by_ref],
883
- RustBuffer.by_value
884
- attach_function :uniffi_chordsketch_ffi_fn_func_convert_irealb_to_chordpro_text,
885
- [RustBuffer.by_value, RustCallStatus.by_ref],
886
- RustBuffer.by_value
887
- attach_function :uniffi_chordsketch_ffi_fn_func_parse_and_render_html,
888
- [RustBuffer.by_value, RustBuffer.by_value, RustBuffer.by_value, RustCallStatus.by_ref],
889
- RustBuffer.by_value
890
- attach_function :uniffi_chordsketch_ffi_fn_func_parse_and_render_html_body,
891
- [RustBuffer.by_value, RustBuffer.by_value, RustBuffer.by_value, RustCallStatus.by_ref],
892
- RustBuffer.by_value
893
- attach_function :uniffi_chordsketch_ffi_fn_func_parse_and_render_html_body_with_warnings,
894
- [RustBuffer.by_value, RustBuffer.by_value, RustBuffer.by_value, RustCallStatus.by_ref],
895
- RustBuffer.by_value
896
- attach_function :uniffi_chordsketch_ffi_fn_func_parse_and_render_html_with_warnings,
897
- [RustBuffer.by_value, RustBuffer.by_value, RustBuffer.by_value, RustCallStatus.by_ref],
898
- RustBuffer.by_value
899
- attach_function :uniffi_chordsketch_ffi_fn_func_parse_and_render_pdf,
900
- [RustBuffer.by_value, RustBuffer.by_value, RustBuffer.by_value, RustCallStatus.by_ref],
901
- RustBuffer.by_value
902
- attach_function :uniffi_chordsketch_ffi_fn_func_parse_and_render_pdf_with_warnings,
903
- [RustBuffer.by_value, RustBuffer.by_value, RustBuffer.by_value, RustCallStatus.by_ref],
904
- RustBuffer.by_value
905
- attach_function :uniffi_chordsketch_ffi_fn_func_parse_and_render_text,
906
- [RustBuffer.by_value, RustBuffer.by_value, RustBuffer.by_value, RustCallStatus.by_ref],
907
- RustBuffer.by_value
908
- attach_function :uniffi_chordsketch_ffi_fn_func_parse_and_render_text_with_warnings,
909
- [RustBuffer.by_value, RustBuffer.by_value, RustBuffer.by_value, RustCallStatus.by_ref],
910
- RustBuffer.by_value
911
- attach_function :uniffi_chordsketch_ffi_fn_func_parse_irealb,
912
- [RustBuffer.by_value, RustCallStatus.by_ref],
913
- RustBuffer.by_value
914
- attach_function :uniffi_chordsketch_ffi_fn_func_render_html_css,
915
- [RustCallStatus.by_ref],
916
- RustBuffer.by_value
917
- attach_function :uniffi_chordsketch_ffi_fn_func_render_html_css_with_config_json,
918
- [RustBuffer.by_value, RustCallStatus.by_ref],
919
- RustBuffer.by_value
920
- attach_function :uniffi_chordsketch_ffi_fn_func_render_ireal_pdf,
921
- [RustBuffer.by_value, RustCallStatus.by_ref],
922
- RustBuffer.by_value
923
- attach_function :uniffi_chordsketch_ffi_fn_func_render_ireal_png,
924
- [RustBuffer.by_value, RustCallStatus.by_ref],
925
- RustBuffer.by_value
926
- attach_function :uniffi_chordsketch_ffi_fn_func_render_ireal_svg,
927
- [RustBuffer.by_value, RustCallStatus.by_ref],
928
- RustBuffer.by_value
929
- attach_function :uniffi_chordsketch_ffi_fn_func_serialize_irealb,
930
- [RustBuffer.by_value, RustCallStatus.by_ref],
931
- RustBuffer.by_value
1201
+ # Define FFI callback types and structs (vtables, etc.)
1202
+
1203
+ callback :RustFutureContinuationCallback,
1204
+ [:uint64, :int8, ],
1205
+ :void
1206
+
1207
+ callback :ForeignFutureDroppedCallback,
1208
+ [:uint64, ],
1209
+ :void
1210
+
1211
+ callback :CallbackInterfaceFree,
1212
+ [:uint64, ],
1213
+ :void
1214
+
1215
+ callback :CallbackInterfaceClone,
1216
+ [:uint64, ],
1217
+ :uint64
1218
+
1219
+ class ForeignFutureDroppedCallbackStruct < FFI::Struct
1220
+ layout(
1221
+ :handle, :uint64,
1222
+ :free, :ForeignFutureDroppedCallback
1223
+ )
1224
+ end
1225
+
1226
+ class ForeignFutureResultU8 < FFI::Struct
1227
+ layout(
1228
+ :return_value, :uint8,
1229
+ :call_status, RustCallStatus
1230
+ )
1231
+ end
1232
+
1233
+ callback :ForeignFutureCompleteU8,
1234
+ [:uint64, ForeignFutureResultU8.by_value, ],
1235
+ :void
1236
+
1237
+ class ForeignFutureResultI8 < FFI::Struct
1238
+ layout(
1239
+ :return_value, :int8,
1240
+ :call_status, RustCallStatus
1241
+ )
1242
+ end
1243
+
1244
+ callback :ForeignFutureCompleteI8,
1245
+ [:uint64, ForeignFutureResultI8.by_value, ],
1246
+ :void
1247
+
1248
+ class ForeignFutureResultU16 < FFI::Struct
1249
+ layout(
1250
+ :return_value, :uint16,
1251
+ :call_status, RustCallStatus
1252
+ )
1253
+ end
1254
+
1255
+ callback :ForeignFutureCompleteU16,
1256
+ [:uint64, ForeignFutureResultU16.by_value, ],
1257
+ :void
1258
+
1259
+ class ForeignFutureResultI16 < FFI::Struct
1260
+ layout(
1261
+ :return_value, :int16,
1262
+ :call_status, RustCallStatus
1263
+ )
1264
+ end
1265
+
1266
+ callback :ForeignFutureCompleteI16,
1267
+ [:uint64, ForeignFutureResultI16.by_value, ],
1268
+ :void
1269
+
1270
+ class ForeignFutureResultU32 < FFI::Struct
1271
+ layout(
1272
+ :return_value, :uint32,
1273
+ :call_status, RustCallStatus
1274
+ )
1275
+ end
1276
+
1277
+ callback :ForeignFutureCompleteU32,
1278
+ [:uint64, ForeignFutureResultU32.by_value, ],
1279
+ :void
1280
+
1281
+ class ForeignFutureResultI32 < FFI::Struct
1282
+ layout(
1283
+ :return_value, :int32,
1284
+ :call_status, RustCallStatus
1285
+ )
1286
+ end
1287
+
1288
+ callback :ForeignFutureCompleteI32,
1289
+ [:uint64, ForeignFutureResultI32.by_value, ],
1290
+ :void
1291
+
1292
+ class ForeignFutureResultU64 < FFI::Struct
1293
+ layout(
1294
+ :return_value, :uint64,
1295
+ :call_status, RustCallStatus
1296
+ )
1297
+ end
1298
+
1299
+ callback :ForeignFutureCompleteU64,
1300
+ [:uint64, ForeignFutureResultU64.by_value, ],
1301
+ :void
1302
+
1303
+ class ForeignFutureResultI64 < FFI::Struct
1304
+ layout(
1305
+ :return_value, :int64,
1306
+ :call_status, RustCallStatus
1307
+ )
1308
+ end
1309
+
1310
+ callback :ForeignFutureCompleteI64,
1311
+ [:uint64, ForeignFutureResultI64.by_value, ],
1312
+ :void
1313
+
1314
+ class ForeignFutureResultF32 < FFI::Struct
1315
+ layout(
1316
+ :return_value, :float,
1317
+ :call_status, RustCallStatus
1318
+ )
1319
+ end
1320
+
1321
+ callback :ForeignFutureCompleteF32,
1322
+ [:uint64, ForeignFutureResultF32.by_value, ],
1323
+ :void
1324
+
1325
+ class ForeignFutureResultF64 < FFI::Struct
1326
+ layout(
1327
+ :return_value, :double,
1328
+ :call_status, RustCallStatus
1329
+ )
1330
+ end
1331
+
1332
+ callback :ForeignFutureCompleteF64,
1333
+ [:uint64, ForeignFutureResultF64.by_value, ],
1334
+ :void
1335
+
1336
+ class ForeignFutureResultRustBuffer < FFI::Struct
1337
+ layout(
1338
+ :return_value, RustBuffer.by_value,
1339
+ :call_status, RustCallStatus
1340
+ )
1341
+ end
1342
+
1343
+ callback :ForeignFutureCompleteRustBuffer,
1344
+ [:uint64, ForeignFutureResultRustBuffer.by_value, ],
1345
+ :void
1346
+
1347
+ class ForeignFutureResultVoid < FFI::Struct
1348
+ layout(
1349
+ :call_status, RustCallStatus
1350
+ )
1351
+ end
1352
+
1353
+ callback :ForeignFutureCompleteVoid,
1354
+ [:uint64, ForeignFutureResultVoid.by_value, ],
1355
+ :void
1356
+
1357
+ attach_function :uniffi_chordsketch_ffi_fn_func_chord_diagram_svg,
1358
+ [RustBuffer.by_value, RustBuffer.by_value, RustCallStatus.by_ref],
1359
+ RustBuffer.by_value
1360
+
1361
+ attach_function :uniffi_chordsketch_ffi_fn_func_chord_diagram_svg_with_defines,
1362
+ [RustBuffer.by_value, RustBuffer.by_value, RustBuffer.by_value, RustCallStatus.by_ref],
1363
+ RustBuffer.by_value
1364
+
1365
+ attach_function :uniffi_chordsketch_ffi_fn_func_chord_diagram_svg_with_defines_orientation,
1366
+ [RustBuffer.by_value, RustBuffer.by_value, RustBuffer.by_value, RustBuffer.by_value, RustCallStatus.by_ref],
1367
+ RustBuffer.by_value
1368
+
1369
+ attach_function :uniffi_chordsketch_ffi_fn_func_chord_diagram_svg_with_orientation,
1370
+ [RustBuffer.by_value, RustBuffer.by_value, RustBuffer.by_value, RustCallStatus.by_ref],
1371
+ RustBuffer.by_value
1372
+
1373
+ attach_function :uniffi_chordsketch_ffi_fn_func_chord_pitches,
1374
+ [RustBuffer.by_value, RustCallStatus.by_ref],
1375
+ RustBuffer.by_value
1376
+
1377
+ attach_function :uniffi_chordsketch_ffi_fn_func_chord_staff_notes,
1378
+ [RustBuffer.by_value, RustCallStatus.by_ref],
1379
+ RustBuffer.by_value
1380
+
1381
+ attach_function :uniffi_chordsketch_ffi_fn_func_convert_chordpro_to_irealb,
1382
+ [RustBuffer.by_value, RustCallStatus.by_ref],
1383
+ RustBuffer.by_value
1384
+
1385
+ attach_function :uniffi_chordsketch_ffi_fn_func_convert_irealb_to_chordpro_text,
1386
+ [RustBuffer.by_value, RustCallStatus.by_ref],
1387
+ RustBuffer.by_value
1388
+
1389
+ attach_function :uniffi_chordsketch_ffi_fn_func_diagram_pitches,
1390
+ [RustBuffer.by_value, RustBuffer.by_value, RustBuffer.by_value, RustCallStatus.by_ref],
1391
+ RustBuffer.by_value
1392
+
1393
+ attach_function :uniffi_chordsketch_ffi_fn_func_key_scale_pitches,
1394
+ [RustBuffer.by_value, RustCallStatus.by_ref],
1395
+ RustBuffer.by_value
1396
+
1397
+ attach_function :uniffi_chordsketch_ffi_fn_func_key_tonic_triad,
1398
+ [RustBuffer.by_value, RustCallStatus.by_ref],
1399
+ RustBuffer.by_value
1400
+
1401
+ attach_function :uniffi_chordsketch_ffi_fn_func_parse_and_render_html,
1402
+ [RustBuffer.by_value, RustBuffer.by_value, RustBuffer.by_value, RustCallStatus.by_ref],
1403
+ RustBuffer.by_value
1404
+
1405
+ attach_function :uniffi_chordsketch_ffi_fn_func_parse_and_render_html_body,
1406
+ [RustBuffer.by_value, RustBuffer.by_value, RustBuffer.by_value, RustCallStatus.by_ref],
1407
+ RustBuffer.by_value
1408
+
1409
+ attach_function :uniffi_chordsketch_ffi_fn_func_parse_and_render_html_body_with_warnings,
1410
+ [RustBuffer.by_value, RustBuffer.by_value, RustBuffer.by_value, RustCallStatus.by_ref],
1411
+ RustBuffer.by_value
1412
+
1413
+ attach_function :uniffi_chordsketch_ffi_fn_func_parse_and_render_html_with_warnings,
1414
+ [RustBuffer.by_value, RustBuffer.by_value, RustBuffer.by_value, RustCallStatus.by_ref],
1415
+ RustBuffer.by_value
1416
+
1417
+ attach_function :uniffi_chordsketch_ffi_fn_func_parse_and_render_pdf,
1418
+ [RustBuffer.by_value, RustBuffer.by_value, RustBuffer.by_value, RustCallStatus.by_ref],
1419
+ RustBuffer.by_value
1420
+
1421
+ attach_function :uniffi_chordsketch_ffi_fn_func_parse_and_render_pdf_with_warnings,
1422
+ [RustBuffer.by_value, RustBuffer.by_value, RustBuffer.by_value, RustCallStatus.by_ref],
1423
+ RustBuffer.by_value
1424
+
1425
+ attach_function :uniffi_chordsketch_ffi_fn_func_parse_and_render_text,
1426
+ [RustBuffer.by_value, RustBuffer.by_value, RustBuffer.by_value, RustCallStatus.by_ref],
1427
+ RustBuffer.by_value
1428
+
1429
+ attach_function :uniffi_chordsketch_ffi_fn_func_parse_and_render_text_with_warnings,
1430
+ [RustBuffer.by_value, RustBuffer.by_value, RustBuffer.by_value, RustCallStatus.by_ref],
1431
+ RustBuffer.by_value
1432
+
1433
+ attach_function :uniffi_chordsketch_ffi_fn_func_parse_irealb,
1434
+ [RustBuffer.by_value, RustCallStatus.by_ref],
1435
+ RustBuffer.by_value
1436
+
1437
+ attach_function :uniffi_chordsketch_ffi_fn_func_render_html_css,
1438
+ [RustCallStatus.by_ref],
1439
+ RustBuffer.by_value
1440
+
1441
+ attach_function :uniffi_chordsketch_ffi_fn_func_render_html_css_with_config_json,
1442
+ [RustBuffer.by_value, RustCallStatus.by_ref],
1443
+ RustBuffer.by_value
1444
+
1445
+ attach_function :uniffi_chordsketch_ffi_fn_func_render_ireal_pdf,
1446
+ [RustBuffer.by_value, RustCallStatus.by_ref],
1447
+ RustBuffer.by_value
1448
+
1449
+ attach_function :uniffi_chordsketch_ffi_fn_func_render_ireal_png,
1450
+ [RustBuffer.by_value, RustCallStatus.by_ref],
1451
+ RustBuffer.by_value
1452
+
1453
+ attach_function :uniffi_chordsketch_ffi_fn_func_render_ireal_svg,
1454
+ [RustBuffer.by_value, RustCallStatus.by_ref],
1455
+ RustBuffer.by_value
1456
+
1457
+ attach_function :uniffi_chordsketch_ffi_fn_func_serialize_irealb,
1458
+ [RustBuffer.by_value, RustCallStatus.by_ref],
1459
+ RustBuffer.by_value
1460
+
932
1461
  attach_function :uniffi_chordsketch_ffi_fn_func_validate,
933
1462
  [RustBuffer.by_value, RustCallStatus.by_ref],
934
1463
  RustBuffer.by_value
1464
+
935
1465
  attach_function :uniffi_chordsketch_ffi_fn_func_version,
936
1466
  [RustCallStatus.by_ref],
937
1467
  RustBuffer.by_value
1468
+
938
1469
  attach_function :ffi_chordsketch_ffi_rustbuffer_alloc,
939
1470
  [:uint64, RustCallStatus.by_ref],
940
1471
  RustBuffer.by_value
1472
+
941
1473
  attach_function :ffi_chordsketch_ffi_rustbuffer_from_bytes,
942
1474
  [ForeignBytes, RustCallStatus.by_ref],
943
1475
  RustBuffer.by_value
1476
+
944
1477
  attach_function :ffi_chordsketch_ffi_rustbuffer_free,
945
1478
  [RustBuffer.by_value, RustCallStatus.by_ref],
946
1479
  :void
1480
+
947
1481
  attach_function :ffi_chordsketch_ffi_rustbuffer_reserve,
948
1482
  [RustBuffer.by_value, :uint64, RustCallStatus.by_ref],
949
1483
  RustBuffer.by_value
1484
+
1485
+ attach_function :ffi_chordsketch_ffi_rust_future_poll_u8,
1486
+ [:uint64, :RustFutureContinuationCallback, :uint64, ],
1487
+ :void
1488
+
1489
+ attach_function :ffi_chordsketch_ffi_rust_future_cancel_u8,
1490
+ [:uint64, ],
1491
+ :void
1492
+
1493
+ attach_function :ffi_chordsketch_ffi_rust_future_free_u8,
1494
+ [:uint64, ],
1495
+ :void
1496
+
1497
+ attach_function :ffi_chordsketch_ffi_rust_future_complete_u8,
1498
+ [:uint64, RustCallStatus.by_ref],
1499
+ :uint8
1500
+
1501
+ attach_function :ffi_chordsketch_ffi_rust_future_poll_i8,
1502
+ [:uint64, :RustFutureContinuationCallback, :uint64, ],
1503
+ :void
1504
+
1505
+ attach_function :ffi_chordsketch_ffi_rust_future_cancel_i8,
1506
+ [:uint64, ],
1507
+ :void
1508
+
1509
+ attach_function :ffi_chordsketch_ffi_rust_future_free_i8,
1510
+ [:uint64, ],
1511
+ :void
1512
+
1513
+ attach_function :ffi_chordsketch_ffi_rust_future_complete_i8,
1514
+ [:uint64, RustCallStatus.by_ref],
1515
+ :int8
1516
+
1517
+ attach_function :ffi_chordsketch_ffi_rust_future_poll_u16,
1518
+ [:uint64, :RustFutureContinuationCallback, :uint64, ],
1519
+ :void
1520
+
1521
+ attach_function :ffi_chordsketch_ffi_rust_future_cancel_u16,
1522
+ [:uint64, ],
1523
+ :void
1524
+
1525
+ attach_function :ffi_chordsketch_ffi_rust_future_free_u16,
1526
+ [:uint64, ],
1527
+ :void
1528
+
1529
+ attach_function :ffi_chordsketch_ffi_rust_future_complete_u16,
1530
+ [:uint64, RustCallStatus.by_ref],
1531
+ :uint16
1532
+
1533
+ attach_function :ffi_chordsketch_ffi_rust_future_poll_i16,
1534
+ [:uint64, :RustFutureContinuationCallback, :uint64, ],
1535
+ :void
1536
+
1537
+ attach_function :ffi_chordsketch_ffi_rust_future_cancel_i16,
1538
+ [:uint64, ],
1539
+ :void
1540
+
1541
+ attach_function :ffi_chordsketch_ffi_rust_future_free_i16,
1542
+ [:uint64, ],
1543
+ :void
1544
+
1545
+ attach_function :ffi_chordsketch_ffi_rust_future_complete_i16,
1546
+ [:uint64, RustCallStatus.by_ref],
1547
+ :int16
1548
+
1549
+ attach_function :ffi_chordsketch_ffi_rust_future_poll_u32,
1550
+ [:uint64, :RustFutureContinuationCallback, :uint64, ],
1551
+ :void
1552
+
1553
+ attach_function :ffi_chordsketch_ffi_rust_future_cancel_u32,
1554
+ [:uint64, ],
1555
+ :void
1556
+
1557
+ attach_function :ffi_chordsketch_ffi_rust_future_free_u32,
1558
+ [:uint64, ],
1559
+ :void
1560
+
1561
+ attach_function :ffi_chordsketch_ffi_rust_future_complete_u32,
1562
+ [:uint64, RustCallStatus.by_ref],
1563
+ :uint32
1564
+
1565
+ attach_function :ffi_chordsketch_ffi_rust_future_poll_i32,
1566
+ [:uint64, :RustFutureContinuationCallback, :uint64, ],
1567
+ :void
1568
+
1569
+ attach_function :ffi_chordsketch_ffi_rust_future_cancel_i32,
1570
+ [:uint64, ],
1571
+ :void
1572
+
1573
+ attach_function :ffi_chordsketch_ffi_rust_future_free_i32,
1574
+ [:uint64, ],
1575
+ :void
1576
+
1577
+ attach_function :ffi_chordsketch_ffi_rust_future_complete_i32,
1578
+ [:uint64, RustCallStatus.by_ref],
1579
+ :int32
1580
+
1581
+ attach_function :ffi_chordsketch_ffi_rust_future_poll_u64,
1582
+ [:uint64, :RustFutureContinuationCallback, :uint64, ],
1583
+ :void
1584
+
1585
+ attach_function :ffi_chordsketch_ffi_rust_future_cancel_u64,
1586
+ [:uint64, ],
1587
+ :void
1588
+
1589
+ attach_function :ffi_chordsketch_ffi_rust_future_free_u64,
1590
+ [:uint64, ],
1591
+ :void
1592
+
1593
+ attach_function :ffi_chordsketch_ffi_rust_future_complete_u64,
1594
+ [:uint64, RustCallStatus.by_ref],
1595
+ :uint64
1596
+
1597
+ attach_function :ffi_chordsketch_ffi_rust_future_poll_i64,
1598
+ [:uint64, :RustFutureContinuationCallback, :uint64, ],
1599
+ :void
1600
+
1601
+ attach_function :ffi_chordsketch_ffi_rust_future_cancel_i64,
1602
+ [:uint64, ],
1603
+ :void
1604
+
1605
+ attach_function :ffi_chordsketch_ffi_rust_future_free_i64,
1606
+ [:uint64, ],
1607
+ :void
1608
+
1609
+ attach_function :ffi_chordsketch_ffi_rust_future_complete_i64,
1610
+ [:uint64, RustCallStatus.by_ref],
1611
+ :int64
1612
+
1613
+ attach_function :ffi_chordsketch_ffi_rust_future_poll_f32,
1614
+ [:uint64, :RustFutureContinuationCallback, :uint64, ],
1615
+ :void
1616
+
1617
+ attach_function :ffi_chordsketch_ffi_rust_future_cancel_f32,
1618
+ [:uint64, ],
1619
+ :void
1620
+
1621
+ attach_function :ffi_chordsketch_ffi_rust_future_free_f32,
1622
+ [:uint64, ],
1623
+ :void
1624
+
1625
+ attach_function :ffi_chordsketch_ffi_rust_future_complete_f32,
1626
+ [:uint64, RustCallStatus.by_ref],
1627
+ :float
1628
+
1629
+ attach_function :ffi_chordsketch_ffi_rust_future_poll_f64,
1630
+ [:uint64, :RustFutureContinuationCallback, :uint64, ],
1631
+ :void
1632
+
1633
+ attach_function :ffi_chordsketch_ffi_rust_future_cancel_f64,
1634
+ [:uint64, ],
1635
+ :void
1636
+
1637
+ attach_function :ffi_chordsketch_ffi_rust_future_free_f64,
1638
+ [:uint64, ],
1639
+ :void
1640
+
1641
+ attach_function :ffi_chordsketch_ffi_rust_future_complete_f64,
1642
+ [:uint64, RustCallStatus.by_ref],
1643
+ :double
1644
+
1645
+ attach_function :ffi_chordsketch_ffi_rust_future_poll_rust_buffer,
1646
+ [:uint64, :RustFutureContinuationCallback, :uint64, ],
1647
+ :void
1648
+
1649
+ attach_function :ffi_chordsketch_ffi_rust_future_cancel_rust_buffer,
1650
+ [:uint64, ],
1651
+ :void
1652
+
1653
+ attach_function :ffi_chordsketch_ffi_rust_future_free_rust_buffer,
1654
+ [:uint64, ],
1655
+ :void
1656
+
1657
+ attach_function :ffi_chordsketch_ffi_rust_future_complete_rust_buffer,
1658
+ [:uint64, RustCallStatus.by_ref],
1659
+ RustBuffer.by_value
1660
+
1661
+ attach_function :ffi_chordsketch_ffi_rust_future_poll_void,
1662
+ [:uint64, :RustFutureContinuationCallback, :uint64, ],
1663
+ :void
1664
+
1665
+ attach_function :ffi_chordsketch_ffi_rust_future_cancel_void,
1666
+ [:uint64, ],
1667
+ :void
1668
+
1669
+ attach_function :ffi_chordsketch_ffi_rust_future_free_void,
1670
+ [:uint64, ],
1671
+ :void
1672
+
1673
+ attach_function :ffi_chordsketch_ffi_rust_future_complete_void,
1674
+ [:uint64, RustCallStatus.by_ref],
1675
+ :void
1676
+
950
1677
  attach_function :uniffi_chordsketch_ffi_checksum_func_chord_diagram_svg,
951
- [RustCallStatus.by_ref],
1678
+ [],
952
1679
  :uint16
1680
+
953
1681
  attach_function :uniffi_chordsketch_ffi_checksum_func_chord_diagram_svg_with_defines,
954
- [RustCallStatus.by_ref],
1682
+ [],
1683
+ :uint16
1684
+
1685
+ attach_function :uniffi_chordsketch_ffi_checksum_func_chord_diagram_svg_with_defines_orientation,
1686
+ [],
955
1687
  :uint16
1688
+
1689
+ attach_function :uniffi_chordsketch_ffi_checksum_func_chord_diagram_svg_with_orientation,
1690
+ [],
1691
+ :uint16
1692
+
1693
+ attach_function :uniffi_chordsketch_ffi_checksum_func_chord_pitches,
1694
+ [],
1695
+ :uint16
1696
+
1697
+ attach_function :uniffi_chordsketch_ffi_checksum_func_chord_staff_notes,
1698
+ [],
1699
+ :uint16
1700
+
956
1701
  attach_function :uniffi_chordsketch_ffi_checksum_func_convert_chordpro_to_irealb,
957
- [RustCallStatus.by_ref],
1702
+ [],
958
1703
  :uint16
1704
+
959
1705
  attach_function :uniffi_chordsketch_ffi_checksum_func_convert_irealb_to_chordpro_text,
960
- [RustCallStatus.by_ref],
1706
+ [],
1707
+ :uint16
1708
+
1709
+ attach_function :uniffi_chordsketch_ffi_checksum_func_diagram_pitches,
1710
+ [],
1711
+ :uint16
1712
+
1713
+ attach_function :uniffi_chordsketch_ffi_checksum_func_key_scale_pitches,
1714
+ [],
1715
+ :uint16
1716
+
1717
+ attach_function :uniffi_chordsketch_ffi_checksum_func_key_tonic_triad,
1718
+ [],
961
1719
  :uint16
1720
+
962
1721
  attach_function :uniffi_chordsketch_ffi_checksum_func_parse_and_render_html,
963
- [RustCallStatus.by_ref],
1722
+ [],
964
1723
  :uint16
1724
+
965
1725
  attach_function :uniffi_chordsketch_ffi_checksum_func_parse_and_render_html_body,
966
- [RustCallStatus.by_ref],
1726
+ [],
967
1727
  :uint16
1728
+
968
1729
  attach_function :uniffi_chordsketch_ffi_checksum_func_parse_and_render_html_body_with_warnings,
969
- [RustCallStatus.by_ref],
1730
+ [],
970
1731
  :uint16
1732
+
971
1733
  attach_function :uniffi_chordsketch_ffi_checksum_func_parse_and_render_html_with_warnings,
972
- [RustCallStatus.by_ref],
1734
+ [],
973
1735
  :uint16
1736
+
974
1737
  attach_function :uniffi_chordsketch_ffi_checksum_func_parse_and_render_pdf,
975
- [RustCallStatus.by_ref],
1738
+ [],
976
1739
  :uint16
1740
+
977
1741
  attach_function :uniffi_chordsketch_ffi_checksum_func_parse_and_render_pdf_with_warnings,
978
- [RustCallStatus.by_ref],
1742
+ [],
979
1743
  :uint16
1744
+
980
1745
  attach_function :uniffi_chordsketch_ffi_checksum_func_parse_and_render_text,
981
- [RustCallStatus.by_ref],
1746
+ [],
982
1747
  :uint16
1748
+
983
1749
  attach_function :uniffi_chordsketch_ffi_checksum_func_parse_and_render_text_with_warnings,
984
- [RustCallStatus.by_ref],
1750
+ [],
985
1751
  :uint16
1752
+
986
1753
  attach_function :uniffi_chordsketch_ffi_checksum_func_parse_irealb,
987
- [RustCallStatus.by_ref],
1754
+ [],
988
1755
  :uint16
1756
+
989
1757
  attach_function :uniffi_chordsketch_ffi_checksum_func_render_html_css,
990
- [RustCallStatus.by_ref],
1758
+ [],
991
1759
  :uint16
1760
+
992
1761
  attach_function :uniffi_chordsketch_ffi_checksum_func_render_html_css_with_config_json,
993
- [RustCallStatus.by_ref],
1762
+ [],
994
1763
  :uint16
1764
+
995
1765
  attach_function :uniffi_chordsketch_ffi_checksum_func_render_ireal_pdf,
996
- [RustCallStatus.by_ref],
1766
+ [],
997
1767
  :uint16
1768
+
998
1769
  attach_function :uniffi_chordsketch_ffi_checksum_func_render_ireal_png,
999
- [RustCallStatus.by_ref],
1770
+ [],
1000
1771
  :uint16
1772
+
1001
1773
  attach_function :uniffi_chordsketch_ffi_checksum_func_render_ireal_svg,
1002
- [RustCallStatus.by_ref],
1774
+ [],
1003
1775
  :uint16
1776
+
1004
1777
  attach_function :uniffi_chordsketch_ffi_checksum_func_serialize_irealb,
1005
- [RustCallStatus.by_ref],
1778
+ [],
1006
1779
  :uint16
1780
+
1007
1781
  attach_function :uniffi_chordsketch_ffi_checksum_func_validate,
1008
- [RustCallStatus.by_ref],
1782
+ [],
1009
1783
  :uint16
1784
+
1010
1785
  attach_function :uniffi_chordsketch_ffi_checksum_func_version,
1011
- [RustCallStatus.by_ref],
1786
+ [],
1012
1787
  :uint16
1788
+
1013
1789
  attach_function :ffi_chordsketch_ffi_uniffi_contract_version,
1014
- [RustCallStatus.by_ref],
1790
+ [],
1015
1791
  :uint32
1016
1792
 
1017
1793
  end
1018
1794
 
1795
+ # Custom type definitions.
1796
+
1019
1797
  # Public interface members begin here.
1020
1798
 
1021
1799
 
@@ -1039,6 +1817,7 @@ class ChordDefine
1039
1817
 
1040
1818
  true
1041
1819
  end
1820
+
1042
1821
  end
1043
1822
 
1044
1823
  # Record type ConversionWithWarnings
@@ -1060,6 +1839,7 @@ class ConversionWithWarnings
1060
1839
 
1061
1840
  true
1062
1841
  end
1842
+
1063
1843
  end
1064
1844
 
1065
1845
  # Record type PdfRenderWithWarnings
@@ -1081,6 +1861,37 @@ class PdfRenderWithWarnings
1081
1861
 
1082
1862
  true
1083
1863
  end
1864
+
1865
+ end
1866
+
1867
+ # Record type StaffNote
1868
+ class StaffNote
1869
+ attr_reader :letter, :accidental, :octave, :midi
1870
+
1871
+ def initialize(letter:, accidental:, octave:, midi:)
1872
+ @letter = letter
1873
+ @accidental = accidental
1874
+ @octave = octave
1875
+ @midi = midi
1876
+ end
1877
+
1878
+ def ==(other)
1879
+ if @letter != other.letter
1880
+ return false
1881
+ end
1882
+ if @accidental != other.accidental
1883
+ return false
1884
+ end
1885
+ if @octave != other.octave
1886
+ return false
1887
+ end
1888
+ if @midi != other.midi
1889
+ return false
1890
+ end
1891
+
1892
+ true
1893
+ end
1894
+
1084
1895
  end
1085
1896
 
1086
1897
  # Record type TextRenderWithWarnings
@@ -1102,6 +1913,7 @@ class TextRenderWithWarnings
1102
1913
 
1103
1914
  true
1104
1915
  end
1916
+
1105
1917
  end
1106
1918
 
1107
1919
  # Record type ValidationError
@@ -1127,6 +1939,7 @@ class ValidationError
1127
1939
 
1128
1940
  true
1129
1941
  end
1942
+
1130
1943
  end
1131
1944
 
1132
1945
 
@@ -1134,14 +1947,14 @@ end
1134
1947
 
1135
1948
 
1136
1949
  def self.chord_diagram_svg(chord, instrument)
1137
- chord = Chordsketch::uniffi_utf8(chord)
1950
+ chord = ::Chordsketch::uniffi_utf8(chord)
1138
1951
 
1139
1952
 
1140
- instrument = Chordsketch::uniffi_utf8(instrument)
1953
+ instrument = ::Chordsketch::uniffi_utf8(instrument)
1141
1954
 
1142
1955
 
1143
- result = Chordsketch.rust_call_with_error(ChordSketchError,:uniffi_chordsketch_ffi_fn_func_chord_diagram_svg,RustBuffer.allocFromString(chord),RustBuffer.allocFromString(instrument))
1144
- return result.consumeIntoOptionalstring
1956
+ result = ::Chordsketch.rust_call_with_error(ChordSketchError,:uniffi_chordsketch_ffi_fn_func_chord_diagram_svg,RustBuffer.alloc_from_string(chord),RustBuffer.alloc_from_string(instrument))
1957
+ return result.consume_into_Optionalstring
1145
1958
  end
1146
1959
 
1147
1960
 
@@ -1149,17 +1962,80 @@ end
1149
1962
 
1150
1963
 
1151
1964
  def self.chord_diagram_svg_with_defines(chord, instrument, defines)
1152
- chord = Chordsketch::uniffi_utf8(chord)
1965
+ chord = ::Chordsketch::uniffi_utf8(chord)
1966
+
1967
+
1968
+ instrument = ::Chordsketch::uniffi_utf8(instrument)
1969
+
1970
+
1971
+ defines = defines
1972
+ RustBuffer.check_lower_SequenceTypeChordDefine(defines)
1973
+
1974
+ result = ::Chordsketch.rust_call_with_error(ChordSketchError,:uniffi_chordsketch_ffi_fn_func_chord_diagram_svg_with_defines,RustBuffer.alloc_from_string(chord),RustBuffer.alloc_from_string(instrument),RustBuffer.alloc_from_SequenceTypeChordDefine(defines))
1975
+ return result.consume_into_Optionalstring
1976
+ end
1977
+
1978
+
1979
+
1980
+
1981
+
1982
+ def self.chord_diagram_svg_with_defines_orientation(chord, instrument, defines, orientation)
1983
+ chord = ::Chordsketch::uniffi_utf8(chord)
1153
1984
 
1154
1985
 
1155
- instrument = Chordsketch::uniffi_utf8(instrument)
1986
+ instrument = ::Chordsketch::uniffi_utf8(instrument)
1156
1987
 
1157
1988
 
1158
1989
  defines = defines
1159
1990
  RustBuffer.check_lower_SequenceTypeChordDefine(defines)
1160
1991
 
1161
- result = Chordsketch.rust_call_with_error(ChordSketchError,:uniffi_chordsketch_ffi_fn_func_chord_diagram_svg_with_defines,RustBuffer.allocFromString(chord),RustBuffer.allocFromString(instrument),RustBuffer.alloc_from_SequenceTypeChordDefine(defines))
1162
- return result.consumeIntoOptionalstring
1992
+ orientation = (orientation ? ::Chordsketch::uniffi_utf8(orientation) : nil)
1993
+ RustBuffer.check_lower_Optionalstring(orientation)
1994
+
1995
+ result = ::Chordsketch.rust_call_with_error(ChordSketchError,:uniffi_chordsketch_ffi_fn_func_chord_diagram_svg_with_defines_orientation,RustBuffer.alloc_from_string(chord),RustBuffer.alloc_from_string(instrument),RustBuffer.alloc_from_SequenceTypeChordDefine(defines),RustBuffer.alloc_from_Optionalstring(orientation))
1996
+ return result.consume_into_Optionalstring
1997
+ end
1998
+
1999
+
2000
+
2001
+
2002
+
2003
+ def self.chord_diagram_svg_with_orientation(chord, instrument, orientation)
2004
+ chord = ::Chordsketch::uniffi_utf8(chord)
2005
+
2006
+
2007
+ instrument = ::Chordsketch::uniffi_utf8(instrument)
2008
+
2009
+
2010
+ orientation = (orientation ? ::Chordsketch::uniffi_utf8(orientation) : nil)
2011
+ RustBuffer.check_lower_Optionalstring(orientation)
2012
+
2013
+ result = ::Chordsketch.rust_call_with_error(ChordSketchError,:uniffi_chordsketch_ffi_fn_func_chord_diagram_svg_with_orientation,RustBuffer.alloc_from_string(chord),RustBuffer.alloc_from_string(instrument),RustBuffer.alloc_from_Optionalstring(orientation))
2014
+ return result.consume_into_Optionalstring
2015
+ end
2016
+
2017
+
2018
+
2019
+
2020
+
2021
+ def self.chord_pitches(chord)
2022
+ chord = ::Chordsketch::uniffi_utf8(chord)
2023
+
2024
+
2025
+ result = ::Chordsketch.rust_call(:uniffi_chordsketch_ffi_fn_func_chord_pitches,RustBuffer.alloc_from_string(chord))
2026
+ return result.consume_into_OptionalSequenceu8
2027
+ end
2028
+
2029
+
2030
+
2031
+
2032
+
2033
+ def self.chord_staff_notes(chord)
2034
+ chord = ::Chordsketch::uniffi_utf8(chord)
2035
+
2036
+
2037
+ result = ::Chordsketch.rust_call(:uniffi_chordsketch_ffi_fn_func_chord_staff_notes,RustBuffer.alloc_from_string(chord))
2038
+ return result.consume_into_OptionalSequenceTypeStaffNote
1163
2039
  end
1164
2040
 
1165
2041
 
@@ -1167,11 +2043,11 @@ end
1167
2043
 
1168
2044
 
1169
2045
  def self.convert_chordpro_to_irealb(input)
1170
- input = Chordsketch::uniffi_utf8(input)
2046
+ input = ::Chordsketch::uniffi_utf8(input)
1171
2047
 
1172
2048
 
1173
- result = Chordsketch.rust_call_with_error(ChordSketchError,:uniffi_chordsketch_ffi_fn_func_convert_chordpro_to_irealb,RustBuffer.allocFromString(input))
1174
- return result.consumeIntoTypeConversionWithWarnings
2049
+ result = ::Chordsketch.rust_call_with_error(ChordSketchError,:uniffi_chordsketch_ffi_fn_func_convert_chordpro_to_irealb,RustBuffer.alloc_from_string(input))
2050
+ return result.consume_into_TypeConversionWithWarnings
1175
2051
  end
1176
2052
 
1177
2053
 
@@ -1179,11 +2055,53 @@ end
1179
2055
 
1180
2056
 
1181
2057
  def self.convert_irealb_to_chordpro_text(input)
1182
- input = Chordsketch::uniffi_utf8(input)
2058
+ input = ::Chordsketch::uniffi_utf8(input)
1183
2059
 
1184
2060
 
1185
- result = Chordsketch.rust_call_with_error(ChordSketchError,:uniffi_chordsketch_ffi_fn_func_convert_irealb_to_chordpro_text,RustBuffer.allocFromString(input))
1186
- return result.consumeIntoTypeConversionWithWarnings
2061
+ result = ::Chordsketch.rust_call_with_error(ChordSketchError,:uniffi_chordsketch_ffi_fn_func_convert_irealb_to_chordpro_text,RustBuffer.alloc_from_string(input))
2062
+ return result.consume_into_TypeConversionWithWarnings
2063
+ end
2064
+
2065
+
2066
+
2067
+
2068
+
2069
+ def self.diagram_pitches(chord, instrument, defines)
2070
+ chord = ::Chordsketch::uniffi_utf8(chord)
2071
+
2072
+
2073
+ instrument = ::Chordsketch::uniffi_utf8(instrument)
2074
+
2075
+
2076
+ defines = defines
2077
+ RustBuffer.check_lower_SequenceTypeChordDefine(defines)
2078
+
2079
+ result = ::Chordsketch.rust_call(:uniffi_chordsketch_ffi_fn_func_diagram_pitches,RustBuffer.alloc_from_string(chord),RustBuffer.alloc_from_string(instrument),RustBuffer.alloc_from_SequenceTypeChordDefine(defines))
2080
+ return result.consume_into_OptionalSequenceu8
2081
+ end
2082
+
2083
+
2084
+
2085
+
2086
+
2087
+ def self.key_scale_pitches(key)
2088
+ key = ::Chordsketch::uniffi_utf8(key)
2089
+
2090
+
2091
+ result = ::Chordsketch.rust_call(:uniffi_chordsketch_ffi_fn_func_key_scale_pitches,RustBuffer.alloc_from_string(key))
2092
+ return result.consume_into_OptionalSequenceu8
2093
+ end
2094
+
2095
+
2096
+
2097
+
2098
+
2099
+ def self.key_tonic_triad(key)
2100
+ key = ::Chordsketch::uniffi_utf8(key)
2101
+
2102
+
2103
+ result = ::Chordsketch.rust_call(:uniffi_chordsketch_ffi_fn_func_key_tonic_triad,RustBuffer.alloc_from_string(key))
2104
+ return result.consume_into_OptionalSequenceu8
1187
2105
  end
1188
2106
 
1189
2107
 
@@ -1191,17 +2109,17 @@ end
1191
2109
 
1192
2110
 
1193
2111
  def self.parse_and_render_html(input, config_json, transpose)
1194
- input = Chordsketch::uniffi_utf8(input)
2112
+ input = ::Chordsketch::uniffi_utf8(input)
1195
2113
 
1196
2114
 
1197
- config_json = (config_json ? Chordsketch::uniffi_utf8(config_json) : nil)
2115
+ config_json = (config_json ? ::Chordsketch::uniffi_utf8(config_json) : nil)
1198
2116
  RustBuffer.check_lower_Optionalstring(config_json)
1199
2117
 
1200
- transpose = (transpose ? Chordsketch::uniffi_in_range(transpose, "i8", -2**7, 2**7) : nil)
2118
+ transpose = (transpose ? ::Chordsketch::uniffi_in_range(transpose, "i8", -2**7, 2**7) : nil)
1201
2119
  RustBuffer.check_lower_Optionali8(transpose)
1202
2120
 
1203
- result = Chordsketch.rust_call_with_error(ChordSketchError,:uniffi_chordsketch_ffi_fn_func_parse_and_render_html,RustBuffer.allocFromString(input),RustBuffer.alloc_from_Optionalstring(config_json),RustBuffer.alloc_from_Optionali8(transpose))
1204
- return result.consumeIntoString
2121
+ result = ::Chordsketch.rust_call_with_error(ChordSketchError,:uniffi_chordsketch_ffi_fn_func_parse_and_render_html,RustBuffer.alloc_from_string(input),RustBuffer.alloc_from_Optionalstring(config_json),RustBuffer.alloc_from_Optionali8(transpose))
2122
+ return result.consume_into_string
1205
2123
  end
1206
2124
 
1207
2125
 
@@ -1209,17 +2127,17 @@ end
1209
2127
 
1210
2128
 
1211
2129
  def self.parse_and_render_html_body(input, config_json, transpose)
1212
- input = Chordsketch::uniffi_utf8(input)
2130
+ input = ::Chordsketch::uniffi_utf8(input)
1213
2131
 
1214
2132
 
1215
- config_json = (config_json ? Chordsketch::uniffi_utf8(config_json) : nil)
2133
+ config_json = (config_json ? ::Chordsketch::uniffi_utf8(config_json) : nil)
1216
2134
  RustBuffer.check_lower_Optionalstring(config_json)
1217
2135
 
1218
- transpose = (transpose ? Chordsketch::uniffi_in_range(transpose, "i8", -2**7, 2**7) : nil)
2136
+ transpose = (transpose ? ::Chordsketch::uniffi_in_range(transpose, "i8", -2**7, 2**7) : nil)
1219
2137
  RustBuffer.check_lower_Optionali8(transpose)
1220
2138
 
1221
- result = Chordsketch.rust_call_with_error(ChordSketchError,:uniffi_chordsketch_ffi_fn_func_parse_and_render_html_body,RustBuffer.allocFromString(input),RustBuffer.alloc_from_Optionalstring(config_json),RustBuffer.alloc_from_Optionali8(transpose))
1222
- return result.consumeIntoString
2139
+ result = ::Chordsketch.rust_call_with_error(ChordSketchError,:uniffi_chordsketch_ffi_fn_func_parse_and_render_html_body,RustBuffer.alloc_from_string(input),RustBuffer.alloc_from_Optionalstring(config_json),RustBuffer.alloc_from_Optionali8(transpose))
2140
+ return result.consume_into_string
1223
2141
  end
1224
2142
 
1225
2143
 
@@ -1227,17 +2145,17 @@ end
1227
2145
 
1228
2146
 
1229
2147
  def self.parse_and_render_html_body_with_warnings(input, config_json, transpose)
1230
- input = Chordsketch::uniffi_utf8(input)
2148
+ input = ::Chordsketch::uniffi_utf8(input)
1231
2149
 
1232
2150
 
1233
- config_json = (config_json ? Chordsketch::uniffi_utf8(config_json) : nil)
2151
+ config_json = (config_json ? ::Chordsketch::uniffi_utf8(config_json) : nil)
1234
2152
  RustBuffer.check_lower_Optionalstring(config_json)
1235
2153
 
1236
- transpose = (transpose ? Chordsketch::uniffi_in_range(transpose, "i8", -2**7, 2**7) : nil)
2154
+ transpose = (transpose ? ::Chordsketch::uniffi_in_range(transpose, "i8", -2**7, 2**7) : nil)
1237
2155
  RustBuffer.check_lower_Optionali8(transpose)
1238
2156
 
1239
- result = Chordsketch.rust_call_with_error(ChordSketchError,:uniffi_chordsketch_ffi_fn_func_parse_and_render_html_body_with_warnings,RustBuffer.allocFromString(input),RustBuffer.alloc_from_Optionalstring(config_json),RustBuffer.alloc_from_Optionali8(transpose))
1240
- return result.consumeIntoTypeTextRenderWithWarnings
2157
+ result = ::Chordsketch.rust_call_with_error(ChordSketchError,:uniffi_chordsketch_ffi_fn_func_parse_and_render_html_body_with_warnings,RustBuffer.alloc_from_string(input),RustBuffer.alloc_from_Optionalstring(config_json),RustBuffer.alloc_from_Optionali8(transpose))
2158
+ return result.consume_into_TypeTextRenderWithWarnings
1241
2159
  end
1242
2160
 
1243
2161
 
@@ -1245,17 +2163,17 @@ end
1245
2163
 
1246
2164
 
1247
2165
  def self.parse_and_render_html_with_warnings(input, config_json, transpose)
1248
- input = Chordsketch::uniffi_utf8(input)
2166
+ input = ::Chordsketch::uniffi_utf8(input)
1249
2167
 
1250
2168
 
1251
- config_json = (config_json ? Chordsketch::uniffi_utf8(config_json) : nil)
2169
+ config_json = (config_json ? ::Chordsketch::uniffi_utf8(config_json) : nil)
1252
2170
  RustBuffer.check_lower_Optionalstring(config_json)
1253
2171
 
1254
- transpose = (transpose ? Chordsketch::uniffi_in_range(transpose, "i8", -2**7, 2**7) : nil)
2172
+ transpose = (transpose ? ::Chordsketch::uniffi_in_range(transpose, "i8", -2**7, 2**7) : nil)
1255
2173
  RustBuffer.check_lower_Optionali8(transpose)
1256
2174
 
1257
- result = Chordsketch.rust_call_with_error(ChordSketchError,:uniffi_chordsketch_ffi_fn_func_parse_and_render_html_with_warnings,RustBuffer.allocFromString(input),RustBuffer.alloc_from_Optionalstring(config_json),RustBuffer.alloc_from_Optionali8(transpose))
1258
- return result.consumeIntoTypeTextRenderWithWarnings
2175
+ result = ::Chordsketch.rust_call_with_error(ChordSketchError,:uniffi_chordsketch_ffi_fn_func_parse_and_render_html_with_warnings,RustBuffer.alloc_from_string(input),RustBuffer.alloc_from_Optionalstring(config_json),RustBuffer.alloc_from_Optionali8(transpose))
2176
+ return result.consume_into_TypeTextRenderWithWarnings
1259
2177
  end
1260
2178
 
1261
2179
 
@@ -1263,17 +2181,17 @@ end
1263
2181
 
1264
2182
 
1265
2183
  def self.parse_and_render_pdf(input, config_json, transpose)
1266
- input = Chordsketch::uniffi_utf8(input)
2184
+ input = ::Chordsketch::uniffi_utf8(input)
1267
2185
 
1268
2186
 
1269
- config_json = (config_json ? Chordsketch::uniffi_utf8(config_json) : nil)
2187
+ config_json = (config_json ? ::Chordsketch::uniffi_utf8(config_json) : nil)
1270
2188
  RustBuffer.check_lower_Optionalstring(config_json)
1271
2189
 
1272
- transpose = (transpose ? Chordsketch::uniffi_in_range(transpose, "i8", -2**7, 2**7) : nil)
2190
+ transpose = (transpose ? ::Chordsketch::uniffi_in_range(transpose, "i8", -2**7, 2**7) : nil)
1273
2191
  RustBuffer.check_lower_Optionali8(transpose)
1274
2192
 
1275
- result = Chordsketch.rust_call_with_error(ChordSketchError,:uniffi_chordsketch_ffi_fn_func_parse_and_render_pdf,RustBuffer.allocFromString(input),RustBuffer.alloc_from_Optionalstring(config_json),RustBuffer.alloc_from_Optionali8(transpose))
1276
- return result.consumeIntoBytes
2193
+ result = ::Chordsketch.rust_call_with_error(ChordSketchError,:uniffi_chordsketch_ffi_fn_func_parse_and_render_pdf,RustBuffer.alloc_from_string(input),RustBuffer.alloc_from_Optionalstring(config_json),RustBuffer.alloc_from_Optionali8(transpose))
2194
+ return result.consume_into_bytes
1277
2195
  end
1278
2196
 
1279
2197
 
@@ -1281,17 +2199,17 @@ end
1281
2199
 
1282
2200
 
1283
2201
  def self.parse_and_render_pdf_with_warnings(input, config_json, transpose)
1284
- input = Chordsketch::uniffi_utf8(input)
2202
+ input = ::Chordsketch::uniffi_utf8(input)
1285
2203
 
1286
2204
 
1287
- config_json = (config_json ? Chordsketch::uniffi_utf8(config_json) : nil)
2205
+ config_json = (config_json ? ::Chordsketch::uniffi_utf8(config_json) : nil)
1288
2206
  RustBuffer.check_lower_Optionalstring(config_json)
1289
2207
 
1290
- transpose = (transpose ? Chordsketch::uniffi_in_range(transpose, "i8", -2**7, 2**7) : nil)
2208
+ transpose = (transpose ? ::Chordsketch::uniffi_in_range(transpose, "i8", -2**7, 2**7) : nil)
1291
2209
  RustBuffer.check_lower_Optionali8(transpose)
1292
2210
 
1293
- result = Chordsketch.rust_call_with_error(ChordSketchError,:uniffi_chordsketch_ffi_fn_func_parse_and_render_pdf_with_warnings,RustBuffer.allocFromString(input),RustBuffer.alloc_from_Optionalstring(config_json),RustBuffer.alloc_from_Optionali8(transpose))
1294
- return result.consumeIntoTypePdfRenderWithWarnings
2211
+ result = ::Chordsketch.rust_call_with_error(ChordSketchError,:uniffi_chordsketch_ffi_fn_func_parse_and_render_pdf_with_warnings,RustBuffer.alloc_from_string(input),RustBuffer.alloc_from_Optionalstring(config_json),RustBuffer.alloc_from_Optionali8(transpose))
2212
+ return result.consume_into_TypePdfRenderWithWarnings
1295
2213
  end
1296
2214
 
1297
2215
 
@@ -1299,17 +2217,17 @@ end
1299
2217
 
1300
2218
 
1301
2219
  def self.parse_and_render_text(input, config_json, transpose)
1302
- input = Chordsketch::uniffi_utf8(input)
2220
+ input = ::Chordsketch::uniffi_utf8(input)
1303
2221
 
1304
2222
 
1305
- config_json = (config_json ? Chordsketch::uniffi_utf8(config_json) : nil)
2223
+ config_json = (config_json ? ::Chordsketch::uniffi_utf8(config_json) : nil)
1306
2224
  RustBuffer.check_lower_Optionalstring(config_json)
1307
2225
 
1308
- transpose = (transpose ? Chordsketch::uniffi_in_range(transpose, "i8", -2**7, 2**7) : nil)
2226
+ transpose = (transpose ? ::Chordsketch::uniffi_in_range(transpose, "i8", -2**7, 2**7) : nil)
1309
2227
  RustBuffer.check_lower_Optionali8(transpose)
1310
2228
 
1311
- result = Chordsketch.rust_call_with_error(ChordSketchError,:uniffi_chordsketch_ffi_fn_func_parse_and_render_text,RustBuffer.allocFromString(input),RustBuffer.alloc_from_Optionalstring(config_json),RustBuffer.alloc_from_Optionali8(transpose))
1312
- return result.consumeIntoString
2229
+ result = ::Chordsketch.rust_call_with_error(ChordSketchError,:uniffi_chordsketch_ffi_fn_func_parse_and_render_text,RustBuffer.alloc_from_string(input),RustBuffer.alloc_from_Optionalstring(config_json),RustBuffer.alloc_from_Optionali8(transpose))
2230
+ return result.consume_into_string
1313
2231
  end
1314
2232
 
1315
2233
 
@@ -1317,17 +2235,17 @@ end
1317
2235
 
1318
2236
 
1319
2237
  def self.parse_and_render_text_with_warnings(input, config_json, transpose)
1320
- input = Chordsketch::uniffi_utf8(input)
2238
+ input = ::Chordsketch::uniffi_utf8(input)
1321
2239
 
1322
2240
 
1323
- config_json = (config_json ? Chordsketch::uniffi_utf8(config_json) : nil)
2241
+ config_json = (config_json ? ::Chordsketch::uniffi_utf8(config_json) : nil)
1324
2242
  RustBuffer.check_lower_Optionalstring(config_json)
1325
2243
 
1326
- transpose = (transpose ? Chordsketch::uniffi_in_range(transpose, "i8", -2**7, 2**7) : nil)
2244
+ transpose = (transpose ? ::Chordsketch::uniffi_in_range(transpose, "i8", -2**7, 2**7) : nil)
1327
2245
  RustBuffer.check_lower_Optionali8(transpose)
1328
2246
 
1329
- result = Chordsketch.rust_call_with_error(ChordSketchError,:uniffi_chordsketch_ffi_fn_func_parse_and_render_text_with_warnings,RustBuffer.allocFromString(input),RustBuffer.alloc_from_Optionalstring(config_json),RustBuffer.alloc_from_Optionali8(transpose))
1330
- return result.consumeIntoTypeTextRenderWithWarnings
2247
+ result = ::Chordsketch.rust_call_with_error(ChordSketchError,:uniffi_chordsketch_ffi_fn_func_parse_and_render_text_with_warnings,RustBuffer.alloc_from_string(input),RustBuffer.alloc_from_Optionalstring(config_json),RustBuffer.alloc_from_Optionali8(transpose))
2248
+ return result.consume_into_TypeTextRenderWithWarnings
1331
2249
  end
1332
2250
 
1333
2251
 
@@ -1335,11 +2253,11 @@ end
1335
2253
 
1336
2254
 
1337
2255
  def self.parse_irealb(input)
1338
- input = Chordsketch::uniffi_utf8(input)
2256
+ input = ::Chordsketch::uniffi_utf8(input)
1339
2257
 
1340
2258
 
1341
- result = Chordsketch.rust_call_with_error(ChordSketchError,:uniffi_chordsketch_ffi_fn_func_parse_irealb,RustBuffer.allocFromString(input))
1342
- return result.consumeIntoString
2259
+ result = ::Chordsketch.rust_call_with_error(ChordSketchError,:uniffi_chordsketch_ffi_fn_func_parse_irealb,RustBuffer.alloc_from_string(input))
2260
+ return result.consume_into_string
1343
2261
  end
1344
2262
 
1345
2263
 
@@ -1347,8 +2265,8 @@ end
1347
2265
 
1348
2266
 
1349
2267
  def self.render_html_css()
1350
- result = Chordsketch.rust_call(:uniffi_chordsketch_ffi_fn_func_render_html_css,)
1351
- return result.consumeIntoString
2268
+ result = ::Chordsketch.rust_call(:uniffi_chordsketch_ffi_fn_func_render_html_css,)
2269
+ return result.consume_into_string
1352
2270
  end
1353
2271
 
1354
2272
 
@@ -1356,11 +2274,11 @@ end
1356
2274
 
1357
2275
 
1358
2276
  def self.render_html_css_with_config_json(config_json)
1359
- config_json = (config_json ? Chordsketch::uniffi_utf8(config_json) : nil)
2277
+ config_json = (config_json ? ::Chordsketch::uniffi_utf8(config_json) : nil)
1360
2278
  RustBuffer.check_lower_Optionalstring(config_json)
1361
2279
 
1362
- result = Chordsketch.rust_call_with_error(ChordSketchError,:uniffi_chordsketch_ffi_fn_func_render_html_css_with_config_json,RustBuffer.alloc_from_Optionalstring(config_json))
1363
- return result.consumeIntoString
2280
+ result = ::Chordsketch.rust_call_with_error(ChordSketchError,:uniffi_chordsketch_ffi_fn_func_render_html_css_with_config_json,RustBuffer.alloc_from_Optionalstring(config_json))
2281
+ return result.consume_into_string
1364
2282
  end
1365
2283
 
1366
2284
 
@@ -1368,11 +2286,11 @@ end
1368
2286
 
1369
2287
 
1370
2288
  def self.render_ireal_pdf(input)
1371
- input = Chordsketch::uniffi_utf8(input)
2289
+ input = ::Chordsketch::uniffi_utf8(input)
1372
2290
 
1373
2291
 
1374
- result = Chordsketch.rust_call_with_error(ChordSketchError,:uniffi_chordsketch_ffi_fn_func_render_ireal_pdf,RustBuffer.allocFromString(input))
1375
- return result.consumeIntoBytes
2292
+ result = ::Chordsketch.rust_call_with_error(ChordSketchError,:uniffi_chordsketch_ffi_fn_func_render_ireal_pdf,RustBuffer.alloc_from_string(input))
2293
+ return result.consume_into_bytes
1376
2294
  end
1377
2295
 
1378
2296
 
@@ -1380,11 +2298,11 @@ end
1380
2298
 
1381
2299
 
1382
2300
  def self.render_ireal_png(input)
1383
- input = Chordsketch::uniffi_utf8(input)
2301
+ input = ::Chordsketch::uniffi_utf8(input)
1384
2302
 
1385
2303
 
1386
- result = Chordsketch.rust_call_with_error(ChordSketchError,:uniffi_chordsketch_ffi_fn_func_render_ireal_png,RustBuffer.allocFromString(input))
1387
- return result.consumeIntoBytes
2304
+ result = ::Chordsketch.rust_call_with_error(ChordSketchError,:uniffi_chordsketch_ffi_fn_func_render_ireal_png,RustBuffer.alloc_from_string(input))
2305
+ return result.consume_into_bytes
1388
2306
  end
1389
2307
 
1390
2308
 
@@ -1392,11 +2310,11 @@ end
1392
2310
 
1393
2311
 
1394
2312
  def self.render_ireal_svg(input)
1395
- input = Chordsketch::uniffi_utf8(input)
2313
+ input = ::Chordsketch::uniffi_utf8(input)
1396
2314
 
1397
2315
 
1398
- result = Chordsketch.rust_call_with_error(ChordSketchError,:uniffi_chordsketch_ffi_fn_func_render_ireal_svg,RustBuffer.allocFromString(input))
1399
- return result.consumeIntoString
2316
+ result = ::Chordsketch.rust_call_with_error(ChordSketchError,:uniffi_chordsketch_ffi_fn_func_render_ireal_svg,RustBuffer.alloc_from_string(input))
2317
+ return result.consume_into_string
1400
2318
  end
1401
2319
 
1402
2320
 
@@ -1404,11 +2322,11 @@ end
1404
2322
 
1405
2323
 
1406
2324
  def self.serialize_irealb(input)
1407
- input = Chordsketch::uniffi_utf8(input)
2325
+ input = ::Chordsketch::uniffi_utf8(input)
1408
2326
 
1409
2327
 
1410
- result = Chordsketch.rust_call_with_error(ChordSketchError,:uniffi_chordsketch_ffi_fn_func_serialize_irealb,RustBuffer.allocFromString(input))
1411
- return result.consumeIntoString
2328
+ result = ::Chordsketch.rust_call_with_error(ChordSketchError,:uniffi_chordsketch_ffi_fn_func_serialize_irealb,RustBuffer.alloc_from_string(input))
2329
+ return result.consume_into_string
1412
2330
  end
1413
2331
 
1414
2332
 
@@ -1416,11 +2334,11 @@ end
1416
2334
 
1417
2335
 
1418
2336
  def self.validate(input)
1419
- input = Chordsketch::uniffi_utf8(input)
2337
+ input = ::Chordsketch::uniffi_utf8(input)
1420
2338
 
1421
2339
 
1422
- result = Chordsketch.rust_call(:uniffi_chordsketch_ffi_fn_func_validate,RustBuffer.allocFromString(input))
1423
- return result.consumeIntoSequenceTypeValidationError
2340
+ result = ::Chordsketch.rust_call(:uniffi_chordsketch_ffi_fn_func_validate,RustBuffer.alloc_from_string(input))
2341
+ return result.consume_into_SequenceTypeValidationError
1424
2342
  end
1425
2343
 
1426
2344
 
@@ -1428,13 +2346,15 @@ end
1428
2346
 
1429
2347
 
1430
2348
  def self.version()
1431
- result = Chordsketch.rust_call(:uniffi_chordsketch_ffi_fn_func_version,)
1432
- return result.consumeIntoString
2349
+ result = ::Chordsketch.rust_call(:uniffi_chordsketch_ffi_fn_func_version,)
2350
+ return result.consume_into_string
1433
2351
  end
1434
2352
 
1435
2353
 
1436
2354
 
1437
2355
 
1438
2356
 
2357
+
2358
+
1439
2359
  end
1440
2360