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

Method end

modules/llrt_string_decoder/src/string_decoder.rs:239–253  ·  view source on GitHub ↗
(&mut self, ctx: Ctx<'_>, buffer: Opt<ArrayBufferView<'_>>)

Source from the content-addressed store, hash-verified

237 }
238
239 pub fn end(&mut self, ctx: Ctx<'_>, buffer: Opt<ArrayBufferView<'_>>) -> Result<String> {
240 let output = if let Some(data) = buffer.0.as_ref().and_then(|b| b.as_bytes()) {
241 Some(self.decode_data(&ctx, data)?)
242 } else {
243 None
244 };
245
246 let flush = self.flush(&ctx)?;
247 Ok(output
248 .map(|mut o| {
249 o.push_str(&flush);
250 o
251 })
252 .unwrap_or(flush))
253 }
254
255 pub fn write(&mut self, ctx: Ctx<'_>, buffer: ArrayBufferView<'_>) -> Result<String> {
256 let data = buffer

Callers 3

testDecodeFunction · 0.95
testEndFunction · 0.95
testBufFunction · 0.95

Calls 3

decode_dataMethod · 0.80
as_bytesMethod · 0.45
flushMethod · 0.45

Tested by 3

testDecodeFunction · 0.76
testEndFunction · 0.76
testBufFunction · 0.76