@@ -507,7 +507,7 @@ extern "C" {
507
507
/// They are used with `SharedArrayBuffer` objects.
508
508
///
509
509
/// The Atomic operations are installed on an `Atomics` module. Unlike
510
- /// the other global objects, Atomics is not a constructor. You cannot
510
+ /// the other global objects, ` Atomics` is not a constructor. You cannot
511
511
/// use it with a new operator or invoke the `Atomics` object as a
512
512
/// function. All properties and methods of `Atomics` are static
513
513
/// (as is the case with the Math object, for example).
@@ -518,18 +518,14 @@ pub mod Atomics {
518
518
519
519
#[ wasm_bindgen]
520
520
extern "C" {
521
- #[ derive( Clone , Debug ) ]
522
- #[ wasm_bindgen( extends = Object ) ]
523
- pub type Atomics ;
524
-
525
521
/// The static `Atomics.add()` method adds a given value at a given
526
522
/// position in the array and returns the old value at that position.
527
523
/// This atomic operation guarantees that no other write happens
528
524
/// until the modified value is written back.
529
525
///
530
526
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Atomics/add)
531
- #[ wasm_bindgen( static_method_of = Atomics , catch) ]
532
- pub fn add ( typed_array : & JsValue , index : u32 , value : f64 ) -> Result < f64 , JsValue > ;
527
+ #[ wasm_bindgen( js_namespace = Atomics , catch) ]
528
+ pub fn add ( typed_array : & JsValue , index : u32 , value : i32 ) -> Result < i32 , JsValue > ;
533
529
534
530
/// The static `Atomics.and()` method computes a bitwise AND with a given
535
531
/// value at a given position in the array, and returns the old value
@@ -538,8 +534,8 @@ pub mod Atomics {
538
534
/// until the modified value is written back.
539
535
///
540
536
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Atomics/and)
541
- #[ wasm_bindgen( static_method_of = Atomics , catch) ]
542
- pub fn and ( typed_array : & JsValue , index : u32 , value : f64 ) -> Result < f64 , JsValue > ;
537
+ #[ wasm_bindgen( js_namespace = Atomics , catch) ]
538
+ pub fn and ( typed_array : & JsValue , index : u32 , value : i32 ) -> Result < i32 , JsValue > ;
543
539
544
540
/// The static `Atomics.compareExchange()` method exchanges a given
545
541
/// replacement value at a given position in the array, if a given expected
@@ -549,71 +545,71 @@ pub mod Atomics {
549
545
/// until the modified value is written back.
550
546
///
551
547
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Atomics/compareExchange)
552
- #[ wasm_bindgen( static_method_of = Atomics , catch, js_name = compareExchange) ]
548
+ #[ wasm_bindgen( js_namespace = Atomics , catch, js_name = compareExchange) ]
553
549
pub fn compare_exchange (
554
550
typed_array : & JsValue ,
555
551
index : u32 ,
556
- expected_value : f64 ,
557
- replacement_value : f64 ,
558
- ) -> Result < f64 , JsValue > ;
552
+ expected_value : i32 ,
553
+ replacement_value : i32 ,
554
+ ) -> Result < i32 , JsValue > ;
559
555
560
556
/// The static `Atomics.exchange()` method stores a given value at a given
561
557
/// position in the array and returns the old value at that position.
562
558
/// This atomic operation guarantees that no other write happens
563
559
/// until the modified value is written back.
564
560
///
565
561
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Atomics/exchange)
566
- #[ wasm_bindgen( static_method_of = Atomics , catch) ]
567
- pub fn exchange ( typed_array : & JsValue , index : u32 , value : f64 ) -> Result < f64 , JsValue > ;
562
+ #[ wasm_bindgen( js_namespace = Atomics , catch) ]
563
+ pub fn exchange ( typed_array : & JsValue , index : u32 , value : i32 ) -> Result < i32 , JsValue > ;
568
564
569
565
/// The static `Atomics.isLockFree()` method is used to determine
570
566
/// whether to use locks or atomic operations. It returns true,
571
567
/// if the given size is one of the `BYTES_PER_ELEMENT` property
572
568
/// of integer `TypedArray` types.
573
569
///
574
570
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Atomics/isLockFree)
575
- #[ wasm_bindgen( static_method_of = Atomics , js_name = isLockFree) ]
571
+ #[ wasm_bindgen( js_namespace = Atomics , js_name = isLockFree) ]
576
572
pub fn is_lock_free ( size : u32 ) -> bool ;
577
573
578
574
/// The static `Atomics.load()` method returns a value at a given
579
575
/// position in the array.
580
576
///
581
577
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Atomics/load)
582
- #[ wasm_bindgen( static_method_of = Atomics , catch) ]
583
- pub fn load ( typed_array : & JsValue , index : u32 ) -> Result < f64 , JsValue > ;
578
+ #[ wasm_bindgen( js_namespace = Atomics , catch) ]
579
+ pub fn load ( typed_array : & JsValue , index : u32 ) -> Result < i32 , JsValue > ;
584
580
585
581
/// The static `Atomics.notify()` method notifies up some agents that
586
582
/// are sleeping in the wait queue.
587
583
/// Note: This operation works with a shared `Int32Array` only.
588
584
///
589
585
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Atomics/notify)
590
- #[ wasm_bindgen( static_method_of = Atomics , catch) ]
591
- pub fn notify ( typed_array : & JsValue , index : u32 , count : u32 ) -> Result < u32 , JsValue > ;
586
+ #[ wasm_bindgen( js_namespace = Atomics , catch) ]
587
+ pub fn notify ( typed_array : & Int32Array , index : u32 , count : u32 ) -> Result < u32 , JsValue > ;
592
588
593
589
/// The static `Atomics.or()` method computes a bitwise OR with a given value
594
590
/// at a given position in the array, and returns the old value at that position.
595
591
/// This atomic operation guarantees that no other write happens
596
592
/// until the modified value is written back.
597
593
///
598
594
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Atomics/or)
599
- #[ wasm_bindgen( static_method_of = Atomics , catch) ]
600
- pub fn or ( typed_array : & JsValue , index : u32 , value : f64 ) -> Result < f64 , JsValue > ;
595
+ #[ wasm_bindgen( js_namespace = Atomics , catch) ]
596
+ pub fn or ( typed_array : & JsValue , index : u32 , value : i32 ) -> Result < i32 , JsValue > ;
601
597
602
598
/// The static `Atomics.store()` method stores a given value at the given
603
599
/// position in the array and returns that value.
604
600
///
605
601
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Atomics/store)
606
- #[ wasm_bindgen( static_method_of = Atomics , catch) ]
607
- pub fn store ( typed_array : & JsValue , index : u32 , value : f64 ) -> Result < f64 , JsValue > ;
602
+ #[ wasm_bindgen( js_namespace = Atomics , catch) ]
603
+ pub fn store ( typed_array : & JsValue , index : u32 , value : i32 ) -> Result < i32 , JsValue > ;
608
604
609
605
/// The static `Atomics.sub()` method substracts a given value at a
610
606
/// given position in the array and returns the old value at that position.
611
607
/// This atomic operation guarantees that no other write happens
612
608
/// until the modified value is written back.
613
609
///
614
610
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Atomics/sub)
615
- #[ wasm_bindgen( static_method_of = Atomics , catch) ]
616
- pub fn sub ( typed_array : & JsValue , index : u32 , value : f64 ) -> Result < f64 , JsValue > ;
611
+ #[ wasm_bindgen( js_namespace = Atomics , catch) ]
612
+ pub fn sub ( typed_array : & JsValue , index : u32 , value : i32 ) -> Result < i32 , JsValue > ;
617
613
618
614
/// The static `Atomics.wait()` method verifies that a given
619
615
/// position in an `Int32Array` still contains a given value
@@ -623,15 +619,15 @@ pub mod Atomics {
623
619
/// and may not be allowed on the main thread.
624
620
///
625
621
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Atomics/wait)
626
- #[ wasm_bindgen( static_method_of = Atomics , catch) ]
627
- pub fn wait ( typed_array : & JsValue , index : u32 , value : i32 ) -> Result < JsString , JsValue > ;
622
+ #[ wasm_bindgen( js_namespace = Atomics , catch) ]
623
+ pub fn wait ( typed_array : & Int32Array , index : u32 , value : i32 ) -> Result < JsString , JsValue > ;
628
624
629
625
/// Like `wait()`, but with timeout
630
626
///
631
627
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Atomics/wait)
632
- #[ wasm_bindgen( static_method_of = Atomics , catch, js_name = wait) ]
628
+ #[ wasm_bindgen( js_namespace = Atomics , catch, js_name = wait) ]
633
629
pub fn wait_with_timeout (
634
- typed_array : & JsValue ,
630
+ typed_array : & Int32Array ,
635
631
index : u32 ,
636
632
value : i32 ,
637
633
timeout : f64 ,
@@ -644,8 +640,8 @@ pub mod Atomics {
644
640
/// until the modified value is written back.
645
641
///
646
642
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Atomics/xor)
647
- #[ wasm_bindgen( static_method_of = Atomics , catch) ]
648
- pub fn xor ( typed_array : & JsValue , index : u32 , value : f64 ) -> Result < f64 , JsValue > ;
643
+ #[ wasm_bindgen( js_namespace = Atomics , catch) ]
644
+ pub fn xor ( typed_array : & JsValue , index : u32 , value : i32 ) -> Result < i32 , JsValue > ;
649
645
}
650
646
}
651
647
0 commit comments