Skip to content

Commit 0ddf598

Browse files
committed
Merge branch 'master' into reduce-monomorphization
2 parents 54cdf6c + 3957351 commit 0ddf598

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

remoc/src/rfn/rfn_once.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,11 @@ where
117117

118118
Err(_) = keep_rx => (),
119119

120-
Ok(RFnRequest {argument, result_tx}) = request_rx => {
121-
let result = fun(argument).await;
122-
let _ = result_tx.send(result);
120+
req_res = request_rx => {
121+
if let Ok(RFnRequest {argument, result_tx}) = req_res {
122+
let result = fun(argument).await;
123+
let _ = result_tx.send(result);
124+
}
123125
}
124126
}
125127
}

remoc/tests/rfn/rfn_once.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,20 @@ async fn simple() {
2727
println!("result: {result}");
2828
assert_eq!(result, reply_value);
2929
}
30+
31+
#[cfg_attr(not(feature = "js"), tokio::test)]
32+
#[cfg_attr(feature = "js", wasm_bindgen_test)]
33+
async fn not_called() {
34+
crate::init();
35+
let ((mut a_tx, _), (_, mut b_rx)) = loop_channel::<RFnOnce<_, Result<String, CallError>>>().await;
36+
37+
let rfn = RFnOnce::new_1(|_arg: i16| async move { Ok("reply".to_string()) });
38+
39+
println!("Sending remote function");
40+
a_tx.send(rfn).await.unwrap();
41+
println!("Receiving remote function");
42+
let rfn = b_rx.recv().await.unwrap().unwrap();
43+
44+
println!("Dropping remote function without calling it");
45+
drop(rfn);
46+
}

0 commit comments

Comments
 (0)