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

Method from_encoding

modules/llrt_buffer/src/buffer.rs:75–85  ·  view source on GitHub ↗
(
        ctx: &Ctx<'js>,
        mut bytes: Vec<u8>,
        encoding: Option<String>,
    )

Source from the content-addressed store, hash-verified

73
74 pub fn to_string(&self, ctx: &Ctx<'js>, encoding: &str) -> Result<String> {
75 Encoder::from_str(encoding)
76 .and_then(|enc| enc.encode_to_string(self.0.as_ref(), true))
77 .or_throw(ctx)
78 }
79
80 fn from_array_buffer(ctx: &Ctx<'js>, buffer: ArrayBuffer<'js>) -> Result<Value<'js>> {
81 BufferPrimordials::get(ctx)?
82 .constructor
83 .construct((buffer,))
84 }
85
86 fn from_array_buffer_offset_length(
87 ctx: &Ctx<'js>,
88 array_buffer: ArrayBuffer<'js>,

Callers

nothing calls this directly

Calls 4

or_throwMethod · 0.80
BufferClass · 0.70
decodeMethod · 0.45
into_jsMethod · 0.45

Tested by

no test coverage detected