@@ -515,6 +515,7 @@ pub async fn yield_async() {
515515/// When `enabled` is `true`, this tells the host to defer any new calls to this
516516/// component instance until further notice (i.e. until `backpressure.set` is
517517/// called again with `enabled` set to `false`).
518+ #[ deprecated = "use backpressure_{inc,dec} instead" ]
518519pub fn backpressure_set ( enabled : bool ) {
519520 #[ cfg( not( target_arch = "wasm32" ) ) ]
520521 unsafe fn backpressure_set ( _: i32 ) {
@@ -531,6 +532,40 @@ pub fn backpressure_set(enabled: bool) {
531532 unsafe { backpressure_set ( if enabled { 1 } else { 0 } ) }
532533}
533534
535+ /// Call the `backpressure.inc` canonical built-in function.
536+ pub fn backpressure_inc ( ) {
537+ #[ cfg( not( target_arch = "wasm32" ) ) ]
538+ unsafe fn backpressure_inc ( ) {
539+ unreachable ! ( ) ;
540+ }
541+
542+ #[ cfg( target_arch = "wasm32" ) ]
543+ #[ link( wasm_import_module = "$root" ) ]
544+ extern "C" {
545+ #[ link_name = "[backpressure-inc]" ]
546+ fn backpressure_inc ( ) ;
547+ }
548+
549+ unsafe { backpressure_inc ( ) }
550+ }
551+
552+ /// Call the `backpressure.dec` canonical built-in function.
553+ pub fn backpressure_dec ( ) {
554+ #[ cfg( not( target_arch = "wasm32" ) ) ]
555+ unsafe fn backpressure_dec ( ) {
556+ unreachable ! ( ) ;
557+ }
558+
559+ #[ cfg( target_arch = "wasm32" ) ]
560+ #[ link( wasm_import_module = "$root" ) ]
561+ extern "C" {
562+ #[ link_name = "[backpressure-dec]" ]
563+ fn backpressure_dec ( ) ;
564+ }
565+
566+ unsafe { backpressure_dec ( ) }
567+ }
568+
534569fn context_get ( ) -> * mut u8 {
535570 #[ cfg( not( target_arch = "wasm32" ) ) ]
536571 unsafe fn get ( ) -> * mut u8 {
0 commit comments