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

Function alloc_unsafe

modules/llrt_buffer/src/buffer.rs:147–154  ·  view source on GitHub ↗
(ctx: Ctx<'_>, size: usize)

Source from the content-addressed store, hash-verified

145 if let Some(value) = value.as_int() {
146 let bytes = vec![value as u8; length];
147 return Buffer(bytes).into_js(&ctx);
148 }
149 if let Some(obj) = value.as_object() {
150 if let Some(ob) = ObjectBytes::from_array_buffer(obj)? {
151 let bytes = ob.as_bytes(&ctx)?;
152 return alloc_byte_ref(&ctx, bytes, length);
153 }
154 }
155 }
156
157 Buffer(vec![0; length]).into_js(&ctx)

Callers

nothing calls this directly

Calls 3

maybeuninit_to_u8Function · 0.85
BufferClass · 0.70
into_jsMethod · 0.45

Tested by

no test coverage detected