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

Function array_to_string

modules/llrt_buffer/src/blob.rs:322–344  ·  view source on GitHub ↗
(array: &Array)

Source from the content-addressed store, hash-verified

320 })?);
321 continue;
322 }
323 if let Some(x) = ArrayBuffer::from_object(object.clone()) {
324 data.extend_from_slice(x.as_bytes().ok_or_else(|| {
325 Exception::throw_type(ctx, "Cannot create a blob with detached buffer")
326 })?);
327 continue;
328 }
329 }
330
331 let string = if elem.is_string() {
332 get_lossy_string(elem)?
333 } else {
334 Coerced::<String>::from_js(ctx, elem)?.0
335 };
336 if let EndingType::Transparent = endings {
337 data.extend_from_slice(string.as_bytes());
338 } else {
339 let len = string.len();
340 data.reserve(len);
341
342 let bytes = string.as_bytes();
343 let mut iter = bytes.iter();
344
345 let mut start = 0usize;
346 let mut i = 0usize;
347 let line_ending_is_n = LINE_ENDING[0] == b'\n';

Callers 1

bytes_from_partsFunction · 0.85

Calls 4

joinMethod · 0.80
formatMethod · 0.65
cloneMethod · 0.45
to_stringMethod · 0.45

Tested by

no test coverage detected