From b4a7dc11ce98b3131991f97f9b9493c35479fc7b Mon Sep 17 00:00:00 2001 From: Suhas Thalanki Date: Wed, 18 Sep 2024 22:18:34 -0400 Subject: [PATCH] added method that gives current length of the module in bytes --- crates/wasm-encoder/src/core.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/crates/wasm-encoder/src/core.rs b/crates/wasm-encoder/src/core.rs index feccfdefc1..c60f042de5 100644 --- a/crates/wasm-encoder/src/core.rs +++ b/crates/wasm-encoder/src/core.rs @@ -154,6 +154,11 @@ impl Module { &self.bytes } + /// Give the current size of the module in bytes. + pub fn len(&self) -> usize { + self.bytes.len() + } + /// Finish writing this Wasm module and extract ownership of the encoded /// bytes. pub fn finish(self) -> Vec {