chordsketch 0.2.2 → 0.3.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e17a8906bed629af46c3f5c6bb010dcee56db009cbe58b9fa4418d94b3b46cd3
4
- data.tar.gz: dfc27203b744ba2547d4e7eda6733fbb46194e80b49bdc9f9172f9fe608366d5
3
+ metadata.gz: d1bbee78306f1a5f249a62d93dc550a41dff635e4ec958ee8a189333fb00afec
4
+ data.tar.gz: 7f56a1316b6e426565ce5c1bba3bea7da2b89d4deeb97d0cf0c0915611f7ebbb
5
5
  SHA512:
6
- metadata.gz: 32e5dbc06b499062344de155e0609a67f5c1b766ce8767172814662cc799efe88ffdceb262b0ac4c190a4e796790df2e465c6fbbb1b27599159aa871c6dceef8
7
- data.tar.gz: 886d871c8f3017546d5f97ebb01b5ff3215b4ab2a57e8e85418170b0a65c0bbe30fa575cda38ee692d264557dfee43ed4d9eef7590a523d46857fc896f42197f
6
+ metadata.gz: b16b986ce0ed673e3325ab38fea3bfdf711b469b9b4261b36380eedd165a0ebad6a5595bc32dde37ec693917e67bea29b7904c7cd8df1942c3a19749fb3c6fb9
7
+ data.tar.gz: e6673576a4e6560943353a260b2ac0a3a45c34b15ffb1cc3b4ace506e96e9a93b1629343b955fa1c670592f0ef49ede427b668087af9249459054ed067f74ba8
@@ -126,6 +126,67 @@ end
126
126
  end
127
127
  end
128
128
 
129
+ # The Record type PdfRenderWithWarnings.
130
+
131
+ def self.check_lower_TypePdfRenderWithWarnings(v)
132
+
133
+ RustBuffer.check_lower_Sequencestring(v.warnings)
134
+ end
135
+
136
+ def self.alloc_from_TypePdfRenderWithWarnings(v)
137
+ RustBuffer.allocWithBuilder do |builder|
138
+ builder.write_TypePdfRenderWithWarnings(v)
139
+ return builder.finalize
140
+ end
141
+ end
142
+
143
+ def consumeIntoTypePdfRenderWithWarnings
144
+ consumeWithStream do |stream|
145
+ return stream.readTypePdfRenderWithWarnings
146
+ end
147
+ end
148
+
149
+ # The Record type TextRenderWithWarnings.
150
+
151
+ def self.check_lower_TypeTextRenderWithWarnings(v)
152
+
153
+ RustBuffer.check_lower_Sequencestring(v.warnings)
154
+ end
155
+
156
+ def self.alloc_from_TypeTextRenderWithWarnings(v)
157
+ RustBuffer.allocWithBuilder do |builder|
158
+ builder.write_TypeTextRenderWithWarnings(v)
159
+ return builder.finalize
160
+ end
161
+ end
162
+
163
+ def consumeIntoTypeTextRenderWithWarnings
164
+ consumeWithStream do |stream|
165
+ return stream.readTypeTextRenderWithWarnings
166
+ end
167
+ end
168
+
169
+ # The Record type ValidationError.
170
+
171
+ def self.check_lower_TypeValidationError(v)
172
+
173
+
174
+
175
+ end
176
+
177
+ def self.alloc_from_TypeValidationError(v)
178
+ RustBuffer.allocWithBuilder do |builder|
179
+ builder.write_TypeValidationError(v)
180
+ return builder.finalize
181
+ end
182
+ end
183
+
184
+ def consumeIntoTypeValidationError
185
+ consumeWithStream do |stream|
186
+ return stream.readTypeValidationError
187
+ end
188
+ end
189
+
129
190
 
130
191
 
131
192
  # The Optional<T> type for i8.
@@ -191,6 +252,27 @@ end
191
252
  end
192
253
  end
193
254
 
255
+ # The Sequence<T> type for TypeValidationError.
256
+
257
+ def self.check_lower_SequenceTypeValidationError(v)
258
+ v.each do |item|
259
+ RustBuffer.check_lower_TypeValidationError(item)
260
+ end
261
+ end
262
+
263
+ def self.alloc_from_SequenceTypeValidationError(v)
264
+ RustBuffer.allocWithBuilder do |builder|
265
+ builder.write_SequenceTypeValidationError(v)
266
+ return builder.finalize()
267
+ end
268
+ end
269
+
270
+ def consumeIntoSequenceTypeValidationError
271
+ consumeWithStream do |stream|
272
+ return stream.readSequenceTypeValidationError
273
+ end
274
+ end
275
+
194
276
 
195
277
  end
196
278
 
@@ -241,6 +323,10 @@ class RustBufferStream
241
323
  unpack_from 1, 'c'
242
324
  end
243
325
 
326
+ def readU32
327
+ unpack_from 4, 'L>'
328
+ end
329
+
244
330
  def readString
245
331
  size = unpack_from 4, 'l>'
246
332
 
@@ -257,6 +343,34 @@ class RustBufferStream
257
343
  read(size).force_encoding(Encoding::BINARY)
258
344
  end
259
345
 
346
+ # The Record type PdfRenderWithWarnings.
347
+
348
+ def readTypePdfRenderWithWarnings
349
+ PdfRenderWithWarnings.new(
350
+ output: readBytes,
351
+ warnings: readSequencestring
352
+ )
353
+ end
354
+
355
+ # The Record type TextRenderWithWarnings.
356
+
357
+ def readTypeTextRenderWithWarnings
358
+ TextRenderWithWarnings.new(
359
+ output: readString,
360
+ warnings: readSequencestring
361
+ )
362
+ end
363
+
364
+ # The Record type ValidationError.
365
+
366
+ def readTypeValidationError
367
+ ValidationError.new(
368
+ line: readU32,
369
+ column: readU32,
370
+ message: readString
371
+ )
372
+ end
373
+
260
374
 
261
375
 
262
376
 
@@ -323,6 +437,22 @@ class RustBufferStream
323
437
  items
324
438
  end
325
439
 
440
+ # The Sequence<T> type for TypeValidationError.
441
+
442
+ def readSequenceTypeValidationError
443
+ count = unpack_from 4, 'l>'
444
+
445
+ raise InternalError, 'Unexpected negative sequence length' if count.negative?
446
+
447
+ items = []
448
+
449
+ count.times do
450
+ items.append readTypeValidationError
451
+ end
452
+
453
+ items
454
+ end
455
+
326
456
 
327
457
 
328
458
  def unpack_from(size, format)
@@ -374,6 +504,11 @@ class RustBufferBuilder
374
504
  pack_into(1, 'c', v)
375
505
  end
376
506
 
507
+ def write_U32(v)
508
+ v = Chordsketch::uniffi_in_range(v, "u32", 0, 2**32)
509
+ pack_into(4, 'L>', v)
510
+ end
511
+
377
512
  def write_String(v)
378
513
  v = Chordsketch::uniffi_utf8(v)
379
514
  pack_into 4, 'l>', v.bytes.size
@@ -386,6 +521,28 @@ class RustBufferBuilder
386
521
  write v
387
522
  end
388
523
 
524
+ # The Record type PdfRenderWithWarnings.
525
+
526
+ def write_TypePdfRenderWithWarnings(v)
527
+ self.write_Bytes(v.output)
528
+ self.write_Sequencestring(v.warnings)
529
+ end
530
+
531
+ # The Record type TextRenderWithWarnings.
532
+
533
+ def write_TypeTextRenderWithWarnings(v)
534
+ self.write_String(v.output)
535
+ self.write_Sequencestring(v.warnings)
536
+ end
537
+
538
+ # The Record type ValidationError.
539
+
540
+ def write_TypeValidationError(v)
541
+ self.write_U32(v.line)
542
+ self.write_U32(v.column)
543
+ self.write_String(v.message)
544
+ end
545
+
389
546
 
390
547
 
391
548
  # The Optional<T> type for i8.
@@ -420,6 +577,16 @@ class RustBufferBuilder
420
577
  end
421
578
  end
422
579
 
580
+ # The Sequence<T> type for TypeValidationError.
581
+
582
+ def write_SequenceTypeValidationError(items)
583
+ pack_into(4, 'l>', items.size)
584
+
585
+ items.each do |item|
586
+ self.write_TypeValidationError(item)
587
+ end
588
+ end
589
+
423
590
 
424
591
 
425
592
  private
@@ -568,15 +735,27 @@ module UniFFILib
568
735
  ffi_lib Chordsketch::NATIVE_LIB_PATH
569
736
 
570
737
 
738
+ attach_function :uniffi_chordsketch_ffi_fn_func_chord_diagram_svg,
739
+ [RustBuffer.by_value, RustBuffer.by_value, RustCallStatus.by_ref],
740
+ RustBuffer.by_value
571
741
  attach_function :uniffi_chordsketch_ffi_fn_func_parse_and_render_html,
572
742
  [RustBuffer.by_value, RustBuffer.by_value, RustBuffer.by_value, RustCallStatus.by_ref],
573
743
  RustBuffer.by_value
744
+ attach_function :uniffi_chordsketch_ffi_fn_func_parse_and_render_html_with_warnings,
745
+ [RustBuffer.by_value, RustBuffer.by_value, RustBuffer.by_value, RustCallStatus.by_ref],
746
+ RustBuffer.by_value
574
747
  attach_function :uniffi_chordsketch_ffi_fn_func_parse_and_render_pdf,
575
748
  [RustBuffer.by_value, RustBuffer.by_value, RustBuffer.by_value, RustCallStatus.by_ref],
576
749
  RustBuffer.by_value
750
+ attach_function :uniffi_chordsketch_ffi_fn_func_parse_and_render_pdf_with_warnings,
751
+ [RustBuffer.by_value, RustBuffer.by_value, RustBuffer.by_value, RustCallStatus.by_ref],
752
+ RustBuffer.by_value
577
753
  attach_function :uniffi_chordsketch_ffi_fn_func_parse_and_render_text,
578
754
  [RustBuffer.by_value, RustBuffer.by_value, RustBuffer.by_value, RustCallStatus.by_ref],
579
755
  RustBuffer.by_value
756
+ attach_function :uniffi_chordsketch_ffi_fn_func_parse_and_render_text_with_warnings,
757
+ [RustBuffer.by_value, RustBuffer.by_value, RustBuffer.by_value, RustCallStatus.by_ref],
758
+ RustBuffer.by_value
580
759
  attach_function :uniffi_chordsketch_ffi_fn_func_validate,
581
760
  [RustBuffer.by_value, RustCallStatus.by_ref],
582
761
  RustBuffer.by_value
@@ -595,15 +774,27 @@ module UniFFILib
595
774
  attach_function :ffi_chordsketch_ffi_rustbuffer_reserve,
596
775
  [RustBuffer.by_value, :uint64, RustCallStatus.by_ref],
597
776
  RustBuffer.by_value
777
+ attach_function :uniffi_chordsketch_ffi_checksum_func_chord_diagram_svg,
778
+ [RustCallStatus.by_ref],
779
+ :uint16
598
780
  attach_function :uniffi_chordsketch_ffi_checksum_func_parse_and_render_html,
599
781
  [RustCallStatus.by_ref],
600
782
  :uint16
783
+ attach_function :uniffi_chordsketch_ffi_checksum_func_parse_and_render_html_with_warnings,
784
+ [RustCallStatus.by_ref],
785
+ :uint16
601
786
  attach_function :uniffi_chordsketch_ffi_checksum_func_parse_and_render_pdf,
602
787
  [RustCallStatus.by_ref],
603
788
  :uint16
789
+ attach_function :uniffi_chordsketch_ffi_checksum_func_parse_and_render_pdf_with_warnings,
790
+ [RustCallStatus.by_ref],
791
+ :uint16
604
792
  attach_function :uniffi_chordsketch_ffi_checksum_func_parse_and_render_text,
605
793
  [RustCallStatus.by_ref],
606
794
  :uint16
795
+ attach_function :uniffi_chordsketch_ffi_checksum_func_parse_and_render_text_with_warnings,
796
+ [RustCallStatus.by_ref],
797
+ :uint16
607
798
  attach_function :uniffi_chordsketch_ffi_checksum_func_validate,
608
799
  [RustCallStatus.by_ref],
609
800
  :uint16
@@ -620,6 +811,88 @@ end
620
811
 
621
812
 
622
813
 
814
+ # Record type PdfRenderWithWarnings
815
+ class PdfRenderWithWarnings
816
+ attr_reader :output, :warnings
817
+
818
+ def initialize(output:, warnings:)
819
+ @output = output
820
+ @warnings = warnings
821
+ end
822
+
823
+ def ==(other)
824
+ if @output != other.output
825
+ return false
826
+ end
827
+ if @warnings != other.warnings
828
+ return false
829
+ end
830
+
831
+ true
832
+ end
833
+ end
834
+
835
+ # Record type TextRenderWithWarnings
836
+ class TextRenderWithWarnings
837
+ attr_reader :output, :warnings
838
+
839
+ def initialize(output:, warnings:)
840
+ @output = output
841
+ @warnings = warnings
842
+ end
843
+
844
+ def ==(other)
845
+ if @output != other.output
846
+ return false
847
+ end
848
+ if @warnings != other.warnings
849
+ return false
850
+ end
851
+
852
+ true
853
+ end
854
+ end
855
+
856
+ # Record type ValidationError
857
+ class ValidationError
858
+ attr_reader :line, :column, :message
859
+
860
+ def initialize(line:, column:, message:)
861
+ @line = line
862
+ @column = column
863
+ @message = message
864
+ end
865
+
866
+ def ==(other)
867
+ if @line != other.line
868
+ return false
869
+ end
870
+ if @column != other.column
871
+ return false
872
+ end
873
+ if @message != other.message
874
+ return false
875
+ end
876
+
877
+ true
878
+ end
879
+ end
880
+
881
+
882
+
883
+
884
+
885
+ def self.chord_diagram_svg(chord, instrument)
886
+ chord = Chordsketch::uniffi_utf8(chord)
887
+
888
+
889
+ instrument = Chordsketch::uniffi_utf8(instrument)
890
+
891
+
892
+ result = Chordsketch.rust_call_with_error(ChordSketchError,:uniffi_chordsketch_ffi_fn_func_chord_diagram_svg,RustBuffer.allocFromString(chord),RustBuffer.allocFromString(instrument))
893
+ return result.consumeIntoOptionalstring
894
+ end
895
+
623
896
 
624
897
 
625
898
 
@@ -642,6 +915,24 @@ end
642
915
 
643
916
 
644
917
 
918
+ def self.parse_and_render_html_with_warnings(input, config_json, transpose)
919
+ input = Chordsketch::uniffi_utf8(input)
920
+
921
+
922
+ config_json = (config_json ? Chordsketch::uniffi_utf8(config_json) : nil)
923
+ RustBuffer.check_lower_Optionalstring(config_json)
924
+
925
+ transpose = (transpose ? Chordsketch::uniffi_in_range(transpose, "i8", -2**7, 2**7) : nil)
926
+ RustBuffer.check_lower_Optionali8(transpose)
927
+
928
+ 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))
929
+ return result.consumeIntoTypeTextRenderWithWarnings
930
+ end
931
+
932
+
933
+
934
+
935
+
645
936
  def self.parse_and_render_pdf(input, config_json, transpose)
646
937
  input = Chordsketch::uniffi_utf8(input)
647
938
 
@@ -660,6 +951,24 @@ end
660
951
 
661
952
 
662
953
 
954
+ def self.parse_and_render_pdf_with_warnings(input, config_json, transpose)
955
+ input = Chordsketch::uniffi_utf8(input)
956
+
957
+
958
+ config_json = (config_json ? Chordsketch::uniffi_utf8(config_json) : nil)
959
+ RustBuffer.check_lower_Optionalstring(config_json)
960
+
961
+ transpose = (transpose ? Chordsketch::uniffi_in_range(transpose, "i8", -2**7, 2**7) : nil)
962
+ RustBuffer.check_lower_Optionali8(transpose)
963
+
964
+ 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))
965
+ return result.consumeIntoTypePdfRenderWithWarnings
966
+ end
967
+
968
+
969
+
970
+
971
+
663
972
  def self.parse_and_render_text(input, config_json, transpose)
664
973
  input = Chordsketch::uniffi_utf8(input)
665
974
 
@@ -678,12 +987,30 @@ end
678
987
 
679
988
 
680
989
 
990
+ def self.parse_and_render_text_with_warnings(input, config_json, transpose)
991
+ input = Chordsketch::uniffi_utf8(input)
992
+
993
+
994
+ config_json = (config_json ? Chordsketch::uniffi_utf8(config_json) : nil)
995
+ RustBuffer.check_lower_Optionalstring(config_json)
996
+
997
+ transpose = (transpose ? Chordsketch::uniffi_in_range(transpose, "i8", -2**7, 2**7) : nil)
998
+ RustBuffer.check_lower_Optionali8(transpose)
999
+
1000
+ 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))
1001
+ return result.consumeIntoTypeTextRenderWithWarnings
1002
+ end
1003
+
1004
+
1005
+
1006
+
1007
+
681
1008
  def self.validate(input)
682
1009
  input = Chordsketch::uniffi_utf8(input)
683
1010
 
684
1011
 
685
1012
  result = Chordsketch.rust_call(:uniffi_chordsketch_ffi_fn_func_validate,RustBuffer.allocFromString(input))
686
- return result.consumeIntoSequencestring
1013
+ return result.consumeIntoSequenceTypeValidationError
687
1014
  end
688
1015
 
689
1016
 
Binary file
Binary file
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chordsketch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - koedame
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-04-18 00:00:00.000000000 Z
11
+ date: 2026-04-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi