From 880d199cc2c6acb92ae6783b295939c8d6045b67 Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Thu, 6 Feb 2025 11:06:32 -0500 Subject: [PATCH] [Rust] fix length calculation in `stream.write` bindings When calculating the length we pass to the `stream.write` intrinsic, we need to subtract the number of bytes we've already written. I forgot to do that in my original PR. Signed-off-by: Joel Dice --- crates/rust/src/interface.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/rust/src/interface.rs b/crates/rust/src/interface.rs index b7bf24f12..93af07d98 100644 --- a/crates/rust/src/interface.rs +++ b/crates/rust/src/interface.rs @@ -795,7 +795,7 @@ pub mod vtable{ordinal} {{ wit_import, stream, address.add(total * {size}), - u32::try_from(values.len()).unwrap() + u32::try_from(values.len() - (total * {size})).unwrap() ).await }};