MCPcopy Create free account
hub / github.com/awslabs/llrt / flush

Method flush

modules/llrt_string_decoder/src/string_decoder.rs:194–212  ·  view source on GitHub ↗
(&mut self, ctx: &Ctx<'_>)

Source from the content-addressed store, hash-verified

192 }
193
194 fn flush(&mut self, ctx: &Ctx<'_>) -> Result<String> {
195 if matches!(self.encoder, Encoder::Utf16le) && self.buffered_bytes % 2 == 1 {
196 // Ignore a single trailing byte, like the JS decoder does.
197 self.missing_bytes -= 1;
198 self.buffered_bytes -= 1;
199 }
200
201 if self.buffered_bytes == 0 {
202 return Ok(String::new());
203 }
204
205 let res = self.make_string(ctx, &self.buffer);
206
207 self.missing_bytes = 0;
208 self.buffered_bytes = 0;
209 self.buffer.clear();
210
211 res
212 }
213}
214
215#[rquickjs::methods(rename_all = "camelCase")]

Callers 7

write_fileFunction · 0.45
serverFunction · 0.45
call_tcpFunction · 0.45
endMethod · 0.45
generate_bytecode_cacheFunction · 0.45
decompress_chunkMethod · 0.45

Calls 2

make_stringMethod · 0.80
clearMethod · 0.65

Tested by

no test coverage detected