MCPcopy Create free account
hub / github.com/Ray-D-Song/lexe / from_encoding

Method from_encoding

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

Source from the content-addressed store, hash-verified

76 }
77
78 fn from_encoding(
79 ctx: &Ctx<'js>,
80 mut bytes: Vec<u8>,
81 encoding: Option<String>,
82 ) -> Result<Value<'js>> {
83 if let Some(encoding) = encoding {
84 let encoder = Encoder::from_str(&encoding).or_throw(ctx)?;
85 bytes = encoder.decode(bytes).or_throw(ctx)?;
86 }
87 Buffer(bytes).into_js(ctx)
88 }
89}
90
91// Static Methods

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