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

Function alloc_byte_ref

modules/llrt_buffer/src/buffer.rs:138–145  ·  view source on GitHub ↗
(ctx: &Ctx<'js>, byte_ref: &[u8], length: usize)

Source from the content-addressed store, hash-verified

136
137 if let Some(encoding) = encoding.0 {
138 let encoder = Encoder::from_str(&encoding).or_throw(&ctx)?;
139 let bytes = encoder.decode_from_string(string).or_throw(&ctx)?;
140 return alloc_byte_ref(&ctx, &bytes, length);
141 }
142
143 let byte_ref = string.as_bytes();
144
145 return alloc_byte_ref(&ctx, byte_ref, length);
146 }
147 if let Some(value) = value.as_int() {
148 let bytes = vec![value as u8; length];

Callers 1

allocFunction · 0.85

Calls 3

BufferClass · 0.70
lenMethod · 0.45
into_jsMethod · 0.45

Tested by

no test coverage detected