@@ -33,27 +33,37 @@ pub(crate) enum IdlType<'a> {
33
33
34
34
ArrayBuffer ,
35
35
DataView ,
36
- Int8Array ,
36
+ Int8Array {
37
+ immutable : bool ,
38
+ } ,
37
39
Uint8Array {
38
- /// Whether or not the generated web-sys function should use an immutable slice
39
40
immutable : bool ,
40
41
} ,
41
- Uint8ClampedArray ,
42
- Int16Array ,
43
- Uint16Array ,
44
- Int32Array ,
45
- Uint32Array ,
42
+ Uint8ClampedArray {
43
+ immutable : bool ,
44
+ } ,
45
+ Int16Array {
46
+ immutable : bool ,
47
+ } ,
48
+ Uint16Array {
49
+ immutable : bool ,
50
+ } ,
51
+ Int32Array {
52
+ immutable : bool ,
53
+ } ,
54
+ Uint32Array {
55
+ immutable : bool ,
56
+ } ,
46
57
Float32Array {
47
- /// Whether or not the generated web-sys function should use an immutable slice
48
58
immutable : bool ,
49
59
} ,
50
- Float64Array ,
60
+ Float64Array {
61
+ immutable : bool ,
62
+ } ,
51
63
ArrayBufferView {
52
- /// Whether or not the generated web-sys function should use an immutable slice
53
64
immutable : bool ,
54
65
} ,
55
66
BufferSource {
56
- /// Whether or not the generated web-sys function should use an immutable slice
57
67
immutable : bool ,
58
68
} ,
59
69
@@ -381,21 +391,21 @@ terms_to_idl_type! {
381
391
Void => Void
382
392
ArrayBuffer => ArrayBuffer
383
393
DataView => DataView
384
- Int8Array => Int8Array
385
- Int16Array => Int16Array
386
- Int32Array => Int32Array
387
- Uint16Array => Uint16Array
388
- Uint32Array => Uint32Array
389
- Uint8ClampedArray => Uint8ClampedArray
390
- Float64Array => Float64Array
391
394
Error => Error
392
395
}
393
396
394
397
terms_to_idl_type_maybe_immutable ! {
395
- Uint8Array => Uint8Array
396
- Float32Array => Float32Array
397
398
ArrayBufferView => ArrayBufferView
398
399
BufferSource => BufferSource
400
+ Float32Array => Float32Array
401
+ Float64Array => Float64Array
402
+ Int16Array => Int16Array
403
+ Int32Array => Int32Array
404
+ Int8Array => Int8Array
405
+ Uint16Array => Uint16Array
406
+ Uint32Array => Uint32Array
407
+ Uint8Array => Uint8Array
408
+ Uint8ClampedArray => Uint8ClampedArray
399
409
}
400
410
401
411
impl < ' a > IdlType < ' a > {
@@ -421,15 +431,15 @@ impl<'a> IdlType<'a> {
421
431
422
432
IdlType :: ArrayBuffer => dst. push_str ( "array_buffer" ) ,
423
433
IdlType :: DataView => dst. push_str ( "data_view" ) ,
424
- IdlType :: Int8Array => dst. push_str ( "i8_array" ) ,
434
+ IdlType :: Int8Array { .. } => dst. push_str ( "i8_array" ) ,
425
435
IdlType :: Uint8Array { .. } => dst. push_str ( "u8_array" ) ,
426
- IdlType :: Uint8ClampedArray => dst. push_str ( "u8_clamped_array" ) ,
427
- IdlType :: Int16Array => dst. push_str ( "i16_array" ) ,
428
- IdlType :: Uint16Array => dst. push_str ( "u16_array" ) ,
429
- IdlType :: Int32Array => dst. push_str ( "i32_array" ) ,
430
- IdlType :: Uint32Array => dst. push_str ( "u32_array" ) ,
436
+ IdlType :: Uint8ClampedArray { .. } => dst. push_str ( "u8_clamped_array" ) ,
437
+ IdlType :: Int16Array { .. } => dst. push_str ( "i16_array" ) ,
438
+ IdlType :: Uint16Array { .. } => dst. push_str ( "u16_array" ) ,
439
+ IdlType :: Int32Array { .. } => dst. push_str ( "i32_array" ) ,
440
+ IdlType :: Uint32Array { .. } => dst. push_str ( "u32_array" ) ,
431
441
IdlType :: Float32Array { .. } => dst. push_str ( "f32_array" ) ,
432
- IdlType :: Float64Array => dst. push_str ( "f64_array" ) ,
442
+ IdlType :: Float64Array { .. } => dst. push_str ( "f64_array" ) ,
433
443
IdlType :: ArrayBufferView { .. } => dst. push_str ( "array_buffer_view" ) ,
434
444
IdlType :: BufferSource { .. } => dst. push_str ( "buffer_source" ) ,
435
445
@@ -533,15 +543,15 @@ impl<'a> IdlType<'a> {
533
543
534
544
IdlType :: ArrayBuffer => js_sys ( "ArrayBuffer" ) ,
535
545
IdlType :: DataView => None ,
536
- IdlType :: Int8Array => Some ( array ( "i8" , pos, false ) ) ,
546
+ IdlType :: Int8Array { immutable } => Some ( array ( "i8" , pos, * immutable ) ) ,
537
547
IdlType :: Uint8Array { immutable } => Some ( array ( "u8" , pos, * immutable) ) ,
538
- IdlType :: Uint8ClampedArray => Some ( clamped ( array ( "u8" , pos, false ) ) ) ,
539
- IdlType :: Int16Array => Some ( array ( "i16" , pos, false ) ) ,
540
- IdlType :: Uint16Array => Some ( array ( "u16" , pos, false ) ) ,
541
- IdlType :: Int32Array => Some ( array ( "i32" , pos, false ) ) ,
542
- IdlType :: Uint32Array => Some ( array ( "u32" , pos, false ) ) ,
548
+ IdlType :: Uint8ClampedArray { immutable } => Some ( clamped ( array ( "u8" , pos, * immutable ) ) ) ,
549
+ IdlType :: Int16Array { immutable } => Some ( array ( "i16" , pos, * immutable ) ) ,
550
+ IdlType :: Uint16Array { immutable } => Some ( array ( "u16" , pos, * immutable ) ) ,
551
+ IdlType :: Int32Array { immutable } => Some ( array ( "i32" , pos, * immutable ) ) ,
552
+ IdlType :: Uint32Array { immutable } => Some ( array ( "u32" , pos, * immutable ) ) ,
543
553
IdlType :: Float32Array { immutable } => Some ( array ( "f32" , pos, * immutable) ) ,
544
- IdlType :: Float64Array => Some ( array ( "f64" , pos, false ) ) ,
554
+ IdlType :: Float64Array { immutable } => Some ( array ( "f64" , pos, * immutable ) ) ,
545
555
546
556
IdlType :: ArrayBufferView { .. } | IdlType :: BufferSource { .. } => js_sys ( "Object" ) ,
547
557
IdlType :: Interface ( name)
0 commit comments