(
ctx: &Ctx<'js>,
mut bytes: Vec<u8>,
encoding: Option<String>,
)
| 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>, |