Skip to content

Commit 5d8fa61

Browse files
authored
[Rust] fix length calculation in stream.write bindings (#1157)
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 <joel.dice@fermyon.com>
1 parent f2393e6 commit 5d8fa61

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

crates/rust/src/interface.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -795,7 +795,7 @@ pub mod vtable{ordinal} {{
795795
wit_import,
796796
stream,
797797
address.add(total * {size}),
798-
u32::try_from(values.len()).unwrap()
798+
u32::try_from(values.len() - (total * {size})).unwrap()
799799
).await
800800
}};
801801

0 commit comments

Comments
 (0)