chordsketch 0.3.0 → 0.5.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: d1bbee78306f1a5f249a62d93dc550a41dff635e4ec958ee8a189333fb00afec
4
- data.tar.gz: 7f56a1316b6e426565ce5c1bba3bea7da2b89d4deeb97d0cf0c0915611f7ebbb
3
+ metadata.gz: '065980b2806a293a5a82867deedd6989dec345ce3fca28ccde112260b60f843c'
4
+ data.tar.gz: b40c70f782e2faebb1530844010bbf7440183393b59fab1734e1a415f7c7a1c7
5
5
  SHA512:
6
- metadata.gz: b16b986ce0ed673e3325ab38fea3bfdf711b469b9b4261b36380eedd165a0ebad6a5595bc32dde37ec693917e67bea29b7904c7cd8df1942c3a19749fb3c6fb9
7
- data.tar.gz: e6673576a4e6560943353a260b2ac0a3a45c34b15ffb1cc3b4ace506e96e9a93b1629343b955fa1c670592f0ef49ede427b668087af9249459054ed067f74ba8
6
+ metadata.gz: 62055b40808a53ad298def181ca368205bd3ad19391711601eed0927c5655d85f36ac3fcbe56d27bc89ecc193316f1dadad6276c380503f59131cfffd5683257
7
+ data.tar.gz: ad186050ec7d5dc35b225ee0aa0e0d8418b334bcde15c9d838a165a76a493a1d9eb990444a5aac7a6e1dfdf7afcf9ebd085af937bb854cc66f5f3a1d44c335fd
@@ -126,6 +126,46 @@ end
126
126
  end
127
127
  end
128
128
 
129
+ # The Record type ChordDefine.
130
+
131
+ def self.check_lower_TypeChordDefine(v)
132
+
133
+
134
+ end
135
+
136
+ def self.alloc_from_TypeChordDefine(v)
137
+ RustBuffer.allocWithBuilder do |builder|
138
+ builder.write_TypeChordDefine(v)
139
+ return builder.finalize
140
+ end
141
+ end
142
+
143
+ def consumeIntoTypeChordDefine
144
+ consumeWithStream do |stream|
145
+ return stream.readTypeChordDefine
146
+ end
147
+ end
148
+
149
+ # The Record type ConversionWithWarnings.
150
+
151
+ def self.check_lower_TypeConversionWithWarnings(v)
152
+
153
+ RustBuffer.check_lower_Sequencestring(v.warnings)
154
+ end
155
+
156
+ def self.alloc_from_TypeConversionWithWarnings(v)
157
+ RustBuffer.allocWithBuilder do |builder|
158
+ builder.write_TypeConversionWithWarnings(v)
159
+ return builder.finalize
160
+ end
161
+ end
162
+
163
+ def consumeIntoTypeConversionWithWarnings
164
+ consumeWithStream do |stream|
165
+ return stream.readTypeConversionWithWarnings
166
+ end
167
+ end
168
+
129
169
  # The Record type PdfRenderWithWarnings.
130
170
 
131
171
  def self.check_lower_TypePdfRenderWithWarnings(v)
@@ -252,6 +292,27 @@ end
252
292
  end
253
293
  end
254
294
 
295
+ # The Sequence<T> type for TypeChordDefine.
296
+
297
+ def self.check_lower_SequenceTypeChordDefine(v)
298
+ v.each do |item|
299
+ RustBuffer.check_lower_TypeChordDefine(item)
300
+ end
301
+ end
302
+
303
+ def self.alloc_from_SequenceTypeChordDefine(v)
304
+ RustBuffer.allocWithBuilder do |builder|
305
+ builder.write_SequenceTypeChordDefine(v)
306
+ return builder.finalize()
307
+ end
308
+ end
309
+
310
+ def consumeIntoSequenceTypeChordDefine
311
+ consumeWithStream do |stream|
312
+ return stream.readSequenceTypeChordDefine
313
+ end
314
+ end
315
+
255
316
  # The Sequence<T> type for TypeValidationError.
256
317
 
257
318
  def self.check_lower_SequenceTypeValidationError(v)
@@ -343,6 +404,24 @@ class RustBufferStream
343
404
  read(size).force_encoding(Encoding::BINARY)
344
405
  end
345
406
 
407
+ # The Record type ChordDefine.
408
+
409
+ def readTypeChordDefine
410
+ ChordDefine.new(
411
+ name: readString,
412
+ raw: readString
413
+ )
414
+ end
415
+
416
+ # The Record type ConversionWithWarnings.
417
+
418
+ def readTypeConversionWithWarnings
419
+ ConversionWithWarnings.new(
420
+ output: readString,
421
+ warnings: readSequencestring
422
+ )
423
+ end
424
+
346
425
  # The Record type PdfRenderWithWarnings.
347
426
 
348
427
  def readTypePdfRenderWithWarnings
@@ -388,6 +467,11 @@ class RustBufferStream
388
467
  readString()
389
468
  )
390
469
  end
470
+ if variant == 3
471
+ return ChordSketchError::ConversionFailed.new(
472
+ readString()
473
+ )
474
+ end
391
475
 
392
476
  raise InternalError, 'Unexpected variant tag for TypeChordSketchError'
393
477
  end
@@ -437,6 +521,22 @@ class RustBufferStream
437
521
  items
438
522
  end
439
523
 
524
+ # The Sequence<T> type for TypeChordDefine.
525
+
526
+ def readSequenceTypeChordDefine
527
+ count = unpack_from 4, 'l>'
528
+
529
+ raise InternalError, 'Unexpected negative sequence length' if count.negative?
530
+
531
+ items = []
532
+
533
+ count.times do
534
+ items.append readTypeChordDefine
535
+ end
536
+
537
+ items
538
+ end
539
+
440
540
  # The Sequence<T> type for TypeValidationError.
441
541
 
442
542
  def readSequenceTypeValidationError
@@ -521,6 +621,20 @@ class RustBufferBuilder
521
621
  write v
522
622
  end
523
623
 
624
+ # The Record type ChordDefine.
625
+
626
+ def write_TypeChordDefine(v)
627
+ self.write_String(v.name)
628
+ self.write_String(v.raw)
629
+ end
630
+
631
+ # The Record type ConversionWithWarnings.
632
+
633
+ def write_TypeConversionWithWarnings(v)
634
+ self.write_String(v.output)
635
+ self.write_Sequencestring(v.warnings)
636
+ end
637
+
524
638
  # The Record type PdfRenderWithWarnings.
525
639
 
526
640
  def write_TypePdfRenderWithWarnings(v)
@@ -577,6 +691,16 @@ class RustBufferBuilder
577
691
  end
578
692
  end
579
693
 
694
+ # The Sequence<T> type for TypeChordDefine.
695
+
696
+ def write_SequenceTypeChordDefine(items)
697
+ pack_into(4, 'l>', items.size)
698
+
699
+ items.each do |item|
700
+ self.write_TypeChordDefine(item)
701
+ end
702
+ end
703
+
580
704
  # The Sequence<T> type for TypeValidationError.
581
705
 
582
706
  def write_SequenceTypeValidationError(items)
@@ -653,6 +777,19 @@ module ChordSketchError
653
777
  attr_reader :reason
654
778
 
655
779
 
780
+ def to_s
781
+ "#{self.class.name}(reason=#{@reason.inspect})"
782
+ end
783
+ end
784
+ class ConversionFailed < StandardError
785
+ def initialize(reason)
786
+ @reason = reason
787
+ super()
788
+ end
789
+
790
+ attr_reader :reason
791
+
792
+
656
793
  def to_s
657
794
  "#{self.class.name}(reason=#{@reason.inspect})"
658
795
  end
@@ -738,9 +875,24 @@ module UniFFILib
738
875
  attach_function :uniffi_chordsketch_ffi_fn_func_chord_diagram_svg,
739
876
  [RustBuffer.by_value, RustBuffer.by_value, RustCallStatus.by_ref],
740
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
741
887
  attach_function :uniffi_chordsketch_ffi_fn_func_parse_and_render_html,
742
888
  [RustBuffer.by_value, RustBuffer.by_value, RustBuffer.by_value, RustCallStatus.by_ref],
743
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
744
896
  attach_function :uniffi_chordsketch_ffi_fn_func_parse_and_render_html_with_warnings,
745
897
  [RustBuffer.by_value, RustBuffer.by_value, RustBuffer.by_value, RustCallStatus.by_ref],
746
898
  RustBuffer.by_value
@@ -756,6 +908,27 @@ module UniFFILib
756
908
  attach_function :uniffi_chordsketch_ffi_fn_func_parse_and_render_text_with_warnings,
757
909
  [RustBuffer.by_value, RustBuffer.by_value, RustBuffer.by_value, RustCallStatus.by_ref],
758
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
759
932
  attach_function :uniffi_chordsketch_ffi_fn_func_validate,
760
933
  [RustBuffer.by_value, RustCallStatus.by_ref],
761
934
  RustBuffer.by_value
@@ -777,9 +950,24 @@ module UniFFILib
777
950
  attach_function :uniffi_chordsketch_ffi_checksum_func_chord_diagram_svg,
778
951
  [RustCallStatus.by_ref],
779
952
  :uint16
953
+ attach_function :uniffi_chordsketch_ffi_checksum_func_chord_diagram_svg_with_defines,
954
+ [RustCallStatus.by_ref],
955
+ :uint16
956
+ attach_function :uniffi_chordsketch_ffi_checksum_func_convert_chordpro_to_irealb,
957
+ [RustCallStatus.by_ref],
958
+ :uint16
959
+ attach_function :uniffi_chordsketch_ffi_checksum_func_convert_irealb_to_chordpro_text,
960
+ [RustCallStatus.by_ref],
961
+ :uint16
780
962
  attach_function :uniffi_chordsketch_ffi_checksum_func_parse_and_render_html,
781
963
  [RustCallStatus.by_ref],
782
964
  :uint16
965
+ attach_function :uniffi_chordsketch_ffi_checksum_func_parse_and_render_html_body,
966
+ [RustCallStatus.by_ref],
967
+ :uint16
968
+ attach_function :uniffi_chordsketch_ffi_checksum_func_parse_and_render_html_body_with_warnings,
969
+ [RustCallStatus.by_ref],
970
+ :uint16
783
971
  attach_function :uniffi_chordsketch_ffi_checksum_func_parse_and_render_html_with_warnings,
784
972
  [RustCallStatus.by_ref],
785
973
  :uint16
@@ -795,6 +983,27 @@ module UniFFILib
795
983
  attach_function :uniffi_chordsketch_ffi_checksum_func_parse_and_render_text_with_warnings,
796
984
  [RustCallStatus.by_ref],
797
985
  :uint16
986
+ attach_function :uniffi_chordsketch_ffi_checksum_func_parse_irealb,
987
+ [RustCallStatus.by_ref],
988
+ :uint16
989
+ attach_function :uniffi_chordsketch_ffi_checksum_func_render_html_css,
990
+ [RustCallStatus.by_ref],
991
+ :uint16
992
+ attach_function :uniffi_chordsketch_ffi_checksum_func_render_html_css_with_config_json,
993
+ [RustCallStatus.by_ref],
994
+ :uint16
995
+ attach_function :uniffi_chordsketch_ffi_checksum_func_render_ireal_pdf,
996
+ [RustCallStatus.by_ref],
997
+ :uint16
998
+ attach_function :uniffi_chordsketch_ffi_checksum_func_render_ireal_png,
999
+ [RustCallStatus.by_ref],
1000
+ :uint16
1001
+ attach_function :uniffi_chordsketch_ffi_checksum_func_render_ireal_svg,
1002
+ [RustCallStatus.by_ref],
1003
+ :uint16
1004
+ attach_function :uniffi_chordsketch_ffi_checksum_func_serialize_irealb,
1005
+ [RustCallStatus.by_ref],
1006
+ :uint16
798
1007
  attach_function :uniffi_chordsketch_ffi_checksum_func_validate,
799
1008
  [RustCallStatus.by_ref],
800
1009
  :uint16
@@ -811,6 +1020,48 @@ end
811
1020
 
812
1021
 
813
1022
 
1023
+ # Record type ChordDefine
1024
+ class ChordDefine
1025
+ attr_reader :name, :raw
1026
+
1027
+ def initialize(name:, raw:)
1028
+ @name = name
1029
+ @raw = raw
1030
+ end
1031
+
1032
+ def ==(other)
1033
+ if @name != other.name
1034
+ return false
1035
+ end
1036
+ if @raw != other.raw
1037
+ return false
1038
+ end
1039
+
1040
+ true
1041
+ end
1042
+ end
1043
+
1044
+ # Record type ConversionWithWarnings
1045
+ class ConversionWithWarnings
1046
+ attr_reader :output, :warnings
1047
+
1048
+ def initialize(output:, warnings:)
1049
+ @output = output
1050
+ @warnings = warnings
1051
+ end
1052
+
1053
+ def ==(other)
1054
+ if @output != other.output
1055
+ return false
1056
+ end
1057
+ if @warnings != other.warnings
1058
+ return false
1059
+ end
1060
+
1061
+ true
1062
+ end
1063
+ end
1064
+
814
1065
  # Record type PdfRenderWithWarnings
815
1066
  class PdfRenderWithWarnings
816
1067
  attr_reader :output, :warnings
@@ -897,6 +1148,48 @@ end
897
1148
 
898
1149
 
899
1150
 
1151
+ def self.chord_diagram_svg_with_defines(chord, instrument, defines)
1152
+ chord = Chordsketch::uniffi_utf8(chord)
1153
+
1154
+
1155
+ instrument = Chordsketch::uniffi_utf8(instrument)
1156
+
1157
+
1158
+ defines = defines
1159
+ RustBuffer.check_lower_SequenceTypeChordDefine(defines)
1160
+
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
1163
+ end
1164
+
1165
+
1166
+
1167
+
1168
+
1169
+ def self.convert_chordpro_to_irealb(input)
1170
+ input = Chordsketch::uniffi_utf8(input)
1171
+
1172
+
1173
+ result = Chordsketch.rust_call_with_error(ChordSketchError,:uniffi_chordsketch_ffi_fn_func_convert_chordpro_to_irealb,RustBuffer.allocFromString(input))
1174
+ return result.consumeIntoTypeConversionWithWarnings
1175
+ end
1176
+
1177
+
1178
+
1179
+
1180
+
1181
+ def self.convert_irealb_to_chordpro_text(input)
1182
+ input = Chordsketch::uniffi_utf8(input)
1183
+
1184
+
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
1187
+ end
1188
+
1189
+
1190
+
1191
+
1192
+
900
1193
  def self.parse_and_render_html(input, config_json, transpose)
901
1194
  input = Chordsketch::uniffi_utf8(input)
902
1195
 
@@ -915,6 +1208,42 @@ end
915
1208
 
916
1209
 
917
1210
 
1211
+ def self.parse_and_render_html_body(input, config_json, transpose)
1212
+ input = Chordsketch::uniffi_utf8(input)
1213
+
1214
+
1215
+ config_json = (config_json ? Chordsketch::uniffi_utf8(config_json) : nil)
1216
+ RustBuffer.check_lower_Optionalstring(config_json)
1217
+
1218
+ transpose = (transpose ? Chordsketch::uniffi_in_range(transpose, "i8", -2**7, 2**7) : nil)
1219
+ RustBuffer.check_lower_Optionali8(transpose)
1220
+
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
1223
+ end
1224
+
1225
+
1226
+
1227
+
1228
+
1229
+ def self.parse_and_render_html_body_with_warnings(input, config_json, transpose)
1230
+ input = Chordsketch::uniffi_utf8(input)
1231
+
1232
+
1233
+ config_json = (config_json ? Chordsketch::uniffi_utf8(config_json) : nil)
1234
+ RustBuffer.check_lower_Optionalstring(config_json)
1235
+
1236
+ transpose = (transpose ? Chordsketch::uniffi_in_range(transpose, "i8", -2**7, 2**7) : nil)
1237
+ RustBuffer.check_lower_Optionali8(transpose)
1238
+
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
1241
+ end
1242
+
1243
+
1244
+
1245
+
1246
+
918
1247
  def self.parse_and_render_html_with_warnings(input, config_json, transpose)
919
1248
  input = Chordsketch::uniffi_utf8(input)
920
1249
 
@@ -1005,6 +1334,87 @@ end
1005
1334
 
1006
1335
 
1007
1336
 
1337
+ def self.parse_irealb(input)
1338
+ input = Chordsketch::uniffi_utf8(input)
1339
+
1340
+
1341
+ result = Chordsketch.rust_call_with_error(ChordSketchError,:uniffi_chordsketch_ffi_fn_func_parse_irealb,RustBuffer.allocFromString(input))
1342
+ return result.consumeIntoString
1343
+ end
1344
+
1345
+
1346
+
1347
+
1348
+
1349
+ def self.render_html_css()
1350
+ result = Chordsketch.rust_call(:uniffi_chordsketch_ffi_fn_func_render_html_css,)
1351
+ return result.consumeIntoString
1352
+ end
1353
+
1354
+
1355
+
1356
+
1357
+
1358
+ def self.render_html_css_with_config_json(config_json)
1359
+ config_json = (config_json ? Chordsketch::uniffi_utf8(config_json) : nil)
1360
+ RustBuffer.check_lower_Optionalstring(config_json)
1361
+
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
1364
+ end
1365
+
1366
+
1367
+
1368
+
1369
+
1370
+ def self.render_ireal_pdf(input)
1371
+ input = Chordsketch::uniffi_utf8(input)
1372
+
1373
+
1374
+ result = Chordsketch.rust_call_with_error(ChordSketchError,:uniffi_chordsketch_ffi_fn_func_render_ireal_pdf,RustBuffer.allocFromString(input))
1375
+ return result.consumeIntoBytes
1376
+ end
1377
+
1378
+
1379
+
1380
+
1381
+
1382
+ def self.render_ireal_png(input)
1383
+ input = Chordsketch::uniffi_utf8(input)
1384
+
1385
+
1386
+ result = Chordsketch.rust_call_with_error(ChordSketchError,:uniffi_chordsketch_ffi_fn_func_render_ireal_png,RustBuffer.allocFromString(input))
1387
+ return result.consumeIntoBytes
1388
+ end
1389
+
1390
+
1391
+
1392
+
1393
+
1394
+ def self.render_ireal_svg(input)
1395
+ input = Chordsketch::uniffi_utf8(input)
1396
+
1397
+
1398
+ result = Chordsketch.rust_call_with_error(ChordSketchError,:uniffi_chordsketch_ffi_fn_func_render_ireal_svg,RustBuffer.allocFromString(input))
1399
+ return result.consumeIntoString
1400
+ end
1401
+
1402
+
1403
+
1404
+
1405
+
1406
+ def self.serialize_irealb(input)
1407
+ input = Chordsketch::uniffi_utf8(input)
1408
+
1409
+
1410
+ result = Chordsketch.rust_call_with_error(ChordSketchError,:uniffi_chordsketch_ffi_fn_func_serialize_irealb,RustBuffer.allocFromString(input))
1411
+ return result.consumeIntoString
1412
+ end
1413
+
1414
+
1415
+
1416
+
1417
+
1008
1418
  def self.validate(input)
1009
1419
  input = Chordsketch::uniffi_utf8(input)
1010
1420
 
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.3.0
4
+ version: 0.5.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-24 00:00:00.000000000 Z
11
+ date: 2026-05-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi